当前位置: 首页 > news >正文

rancher v2.8.1 如何成功注册已有 k8s 集群

需要加入的集群为rke2部署的双节点集群

$ kubectl get node
NAME           STATUS   ROLES                              AGE   VERSION
rke-master01   Ready    control-plane,etcd,master,worker   94d   v1.26.8+rke2r1
rke-master02   Ready    control-plane,etcd,master,worker   93d   v1.26.8+rke2r1

登陆 rancher
在这里插入图片描述

在这里插入图片描述

注意:直接执行截图中的命令,不要改动yaml内容。当执行完后注册集群的agent会报错,随后,我们通过
kubectl edit deploy cattle-cluster-agent -n cattle-system命令添加hostAlias,其他方式会注册失败,例如:先修改yaml再apply执行。

格式如下:

      hostAliases:- hostnames:- rancher02.demo.comip: 192.168.23.80

完整内容:

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:name: proxy-clusterrole-kubeapiserver
rules:
- apiGroups: [""]resources:- nodes/metrics- nodes/proxy- nodes/stats- nodes/log- nodes/specverbs: ["get", "list", "watch", "create"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:name: proxy-role-binding-kubernetes-master
roleRef:apiGroup: rbac.authorization.k8s.iokind: ClusterRolename: proxy-clusterrole-kubeapiserver
subjects:
- apiGroup: rbac.authorization.k8s.iokind: Username: kube-apiserver
---
apiVersion: v1
kind: Namespace
metadata:name: cattle-system---apiVersion: v1
kind: ServiceAccount
metadata:name: cattlenamespace: cattle-system---apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:name: cattle-admin-bindingnamespace: cattle-systemlabels:cattle.io/creator: "norman"
subjects:
- kind: ServiceAccountname: cattlenamespace: cattle-system
roleRef:kind: ClusterRolename: cattle-adminapiGroup: rbac.authorization.k8s.io---apiVersion: v1
kind: Secret
metadata:name: cattle-credentials-535d46anamespace: cattle-system
type: Opaque
data:url: "aHR0cHM6Ly9yYW5jaGVyMDIuZGVtby5jb20="token: "Z2hwZmJkbHBzbTk1NTJ4cXZuYmQ3NW5yOXA1N3d0ZnN4bGJ2dDd6cmwyY3Zwc3BxbGc5NWY1"namespace: ""---apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:name: cattle-adminlabels:cattle.io/creator: "norman"
rules:
- apiGroups:- '*'resources:- '*'verbs:- '*'
- nonResourceURLs:- '*'verbs:- '*'---apiVersion: apps/v1
kind: Deployment
metadata:name: cattle-cluster-agentnamespace: cattle-systemannotations:management.cattle.io/scale-available: "2"
spec:selector:matchLabels:app: cattle-cluster-agenttemplate:metadata:labels:app: cattle-cluster-agentspec:affinity:nodeAffinity:preferredDuringSchedulingIgnoredDuringExecution:- preference:matchExpressions:- key: node-role.kubernetes.io/controlplaneoperator: Invalues:- "true"weight: 100- preference:matchExpressions:- key: node-role.kubernetes.io/control-planeoperator: Invalues:- "true"weight: 100- preference:matchExpressions:- key: node-role.kubernetes.io/masteroperator: Invalues:- "true"weight: 100- preference:matchExpressions:- key: cattle.io/cluster-agentoperator: Invalues:- "true"weight: 1requiredDuringSchedulingIgnoredDuringExecution:nodeSelectorTerms:- matchExpressions:- key: beta.kubernetes.io/osoperator: NotInvalues:- windowspodAntiAffinity:preferredDuringSchedulingIgnoredDuringExecution:- podAffinityTerm:labelSelector:matchExpressions:- key: appoperator: Invalues:- cattle-cluster-agenttopologyKey: kubernetes.io/hostnameweight: 100serviceAccountName: cattlehostAliases:- hostnames:- rancher02.demo.comip: 192.168.23.80tolerations:# No taints or no controlplane nodes found, added defaults- effect: NoSchedulekey: node-role.kubernetes.io/controlplanevalue: "true"- effect: NoSchedulekey: "node-role.kubernetes.io/control-plane"operator: "Exists"- effect: NoSchedulekey: "node-role.kubernetes.io/master"operator: "Exists"containers:- name: cluster-registerimagePullPolicy: IfNotPresentenv:- name: CATTLE_IS_RKEvalue: "false"- name: CATTLE_SERVERvalue: "https://rancher02.demo.com"- name: CATTLE_CA_CHECKSUMvalue: "d818528e6c91a42ed9573c1cbe4b6e3df067d3ebca8b57efccb8e463306e3760"- name: CATTLE_CLUSTERvalue: "true"- name: CATTLE_K8S_MANAGEDvalue: "true"- name: CATTLE_CLUSTER_REGISTRYvalue: ""- name: CATTLE_SERVER_VERSIONvalue: v2.8.1- name: CATTLE_INSTALL_UUIDvalue: 26c8f3d4-ad4d-4412-87e6-2f4ecb3ce63c- name: CATTLE_INGRESS_IP_DOMAINvalue: sslip.ioimage: rancher/rancher-agent:v2.8.1volumeMounts:- name: cattle-credentialsmountPath: /cattle-credentialsreadOnly: truevolumes:- name: cattle-credentialssecret:secretName: cattle-credentials-535d46adefaultMode: 320strategy:type: RollingUpdaterollingUpdate:maxUnavailable: 0maxSurge: 1---
apiVersion: v1
kind: Service
metadata:name: cattle-cluster-agentnamespace: cattle-system
spec:ports:- port: 80targetPort: 80protocol: TCPname: http- port: 443targetPort: 444protocol: TCPname: https-internalselector:app: cattle-cluster-agent

注册成功。如图:
在这里插入图片描述

相关文章:

rancher v2.8.1 如何成功注册已有 k8s 集群

需要加入的集群为rke2部署的双节点集群 $ kubectl get node NAME STATUS ROLES AGE VERSION rke-master01 Ready control-plane,etcd,master,worker 94d v1.26.8rke2r1 rke-master02 Ready control-plane,etcd,mast…...

Vue中$root的使用方法

查看本专栏目录 关于作者 还是大剑师兰特:曾是美国某知名大学计算机专业研究生,现为航空航海领域高级前端工程师;CSDN知名博主,GIS领域优质创作者,深耕openlayers、leaflet、mapbox、cesium,canvas&#x…...

redis 异步队列

//produceMessage.ts 模拟生产者 import Redis from ioredis; const redis new Redis(); // 生产者:将消息推送到队列 async function produceMessage(queueName:string, message:string) {try {await redis.rpush(queueName, message);console.log(Produced messa…...

SpringBoot + Nacos 实现动态化线程池

1.背景 在后台开发中,会经常用到线程池技术,对于线程池核心参数的配置很大程度上依靠经验。然而,由于系统运行过程中存在的不确定性,我们很难一劳永逸地规划一个合理的线程池参数。 在对线程池配置参数进行调整时,一…...

《Docker极简教程》--Dockerfile--Dockerfile的基本语法

Dockerfile是一种文本文件,用于定义Docker镜像的内容和构建步骤。它包含一系列指令,每个指令代表一个构建步骤,从基础镜像开始,逐步构建出最终的镜像。通过Dockerfile,用户可以精确地描述应用程序运行环境的配置、依赖…...

css中, grid-auto-rows: 怎样简写在grid:中

grid-auto-rows:100px; grid-template-columns:1fr 1fr; 👆可以写成👇 grid:auto-flow 100px / 1fr 1fr;在CSS Grid布局中,grid-auto-rows 属性用于指定自动生成的网格容器的行的大小。如果你想要将 grid-auto-rows 的值简写在 grid 属性中&a…...

@ 代码随想录算法训练营第8周(C语言)|Day53(动态规划)

代码随想录算法训练营第8周(C语言)|Day53(动态规划) Day50、动态规划(包含题目 ● 123.买卖股票的最佳时机III ● 188.买卖股票的最佳时机IV ) 123.买卖股票的最佳时机III 题目描述 给定一个数组 price…...

算法-矩阵置零

1、题目来源 73. 矩阵置零 - 力扣(LeetCode) 2、题目描述 给定一个 m x n 的矩阵,如果一个元素为 0 ,则将其所在行和列的所有元素都设为 0 。请使用 原地 算法。 示例 1: 输入:matrix [[1,1,1],[1,0,1…...

xilinx除法器的使用

平台:Vivado2018.3. 芯片:xcku115-flva1517-2-i (active) 最近学习使用了xilinx除法器,在使用过程中出现了很多次除法器的结果和我预计的结果不一致,特此记录学习一下。 参考文件:pg151.下载地址 pg151-div-gen.pdf …...

算法沉淀——递归(leetcode真题剖析)

算法沉淀——递归 01.汉诺塔问题02.合并两个有序链表03.反转链表04.两两交换链表中的节点05.Pow(x, n) 递归是一种通过调用自身的方式来解决问题的算法。在递归算法中,问题被分解为更小的相似子问题,然后通过对这些子问题的解进行组合来解决原始问题。递…...

BERT模型中的input_ids和attention_mask参数

一、概述 1.1 input_ids 在BERT模型及其衍生体中,输入文本首先经过一个分词处理流程,其中文本被细分为单词或子单词(subwords),每个分词随后映射到一个唯一的整数标识符。这些标识符组成了所谓的input_ids数组&#x…...

java+vue_springboot企业设备安全信息系统14jbc

企业防爆安全信息系统采用B/S架构,数据库是MySQL。网站的搭建与开发采用了先进的java进行编写,使用了vue框架。该系统从三个对象:由管理员、人员和企业来对系统进行设计构建。主要功能包括:个人信息修改,对人员管理&am…...

vulhub中Apache Log4j Server 反序列化命令执行漏洞复现(CVE-2017-5645)

Apache Log4j是一个用于Java的日志记录库,其支持启动远程日志服务器。Apache Log4j 2.8.2之前的2.x版本中存在安全漏洞。攻击者可利用该漏洞执行任意代码。 1.我们使用ysoserial生成payload,然后直接发送给your-ip:4712端口即可。 java -jar ysoserial-…...

基于python+django+vue.js开发的医院门诊管理系统/医疗管理系统

功能介绍 平台采用B/S结构,后端采用主流的Python语言进行开发,前端采用主流的Vue.js进行开发。 功能包括:医生管理、科室管理、护士管理、住院管理、药品管理、用户管理、日志管理、系统信息模块。 源码地址 https://github.com/geeeeeee…...

Linux文件系统笔记

文章目录 FILE SYSTEM软硬链接 动静态库 使用别人提供的库 FILE SYSTEM 文件的管理工作: 1.基础知识: 文件 属性 内容不是所有文件都会打开所有的打开的,未打开的文件会进行管理未打开文件,要能做到快速定位文件磁盘–物理存…...

vue封装el-table表格组件

先上效果图&#xff1a; 本文包含了具名插槽、作用域插槽、jsx语法三种&#xff1a; Render.vue&#xff08;很重要&#xff0c;必须有&#xff09;: <script> export default {name: "FreeRender",functional: true,props: {scope:Object,render: Functio…...

「Python系列」Python数据结构

文章目录 一、数据结构二、相关链接 一、数据结构 Python提供了多种内置的数据结构&#xff0c;这些数据结构在编程中非常有用。以下是Python中常见的一些数据结构&#xff1a; 列表&#xff08;List&#xff09;: 列表是Python中最常用的数据结构之一&#xff0c;它是一个有…...

MySQL多实例部署:从概念到实操的全面指南

目录 MySQL多实例管理 单实例 什么是多实例 多实例的好处 多实例的弊端 MySQL多实例用在哪些场景 资金紧张的公司 用户并发访问量不大的业务 大型网站也有用多实例 部署MySQL多实例 rpm和源码的优缺点 二进制方式安装mysql 准备二进制mysql运行所需的环境 准备多…...

C++学习Day07之虚函数和纯虚函数

目录 前言一、程序及输出1.1 虚函数1.2 纯虚函数1.2.1 定义、示例1.2.2 引入原因1.2.3 抽象类 二、分析与总结 前言 在 C 中&#xff0c;虚函数和纯虚函数是实现多态性的重要概念。虚函数是在基类中声明为虚函数的函数&#xff0c;在派生类中可以被重写&#xff0c;实现动态联…...

GZ036 区块链技术应用赛项赛题第9套

2023年全国职业院校技能大赛 高职组 “区块链技术应用” 赛项赛卷&#xff08;9卷&#xff09; 任 务 书 参赛队编号&#xff1a; 背景描述 随着异地务工人员的增多&#xff0c;房屋租赁成为一个广阔是市场&#xff1b;目前&#xff0c;现有技术中的房屋租赁是由…...

网络编程(Modbus进阶)

思维导图 Modbus RTU&#xff08;先学一点理论&#xff09; 概念 Modbus RTU 是工业自动化领域 最广泛应用的串行通信协议&#xff0c;由 Modicon 公司&#xff08;现施耐德电气&#xff09;于 1979 年推出。它以 高效率、强健性、易实现的特点成为工业控制系统的通信标准。 包…...

Linux应用开发之网络套接字编程(实例篇)

服务端与客户端单连接 服务端代码 #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <arpa/inet.h> #include <pthread.h> …...

C++_核心编程_多态案例二-制作饮品

#include <iostream> #include <string> using namespace std;/*制作饮品的大致流程为&#xff1a;煮水 - 冲泡 - 倒入杯中 - 加入辅料 利用多态技术实现本案例&#xff0c;提供抽象制作饮品基类&#xff0c;提供子类制作咖啡和茶叶*//*基类*/ class AbstractDr…...

iOS 26 携众系统重磅更新,但“苹果智能”仍与国行无缘

美国西海岸的夏天&#xff0c;再次被苹果点燃。一年一度的全球开发者大会 WWDC25 如期而至&#xff0c;这不仅是开发者的盛宴&#xff0c;更是全球数亿苹果用户翘首以盼的科技春晚。今年&#xff0c;苹果依旧为我们带来了全家桶式的系统更新&#xff0c;包括 iOS 26、iPadOS 26…...

TDengine 快速体验(Docker 镜像方式)

简介 TDengine 可以通过安装包、Docker 镜像 及云服务快速体验 TDengine 的功能&#xff0c;本节首先介绍如何通过 Docker 快速体验 TDengine&#xff0c;然后介绍如何在 Docker 环境下体验 TDengine 的写入和查询功能。如果你不熟悉 Docker&#xff0c;请使用 安装包的方式快…...

简易版抽奖活动的设计技术方案

1.前言 本技术方案旨在设计一套完整且可靠的抽奖活动逻辑,确保抽奖活动能够公平、公正、公开地进行,同时满足高并发访问、数据安全存储与高效处理等需求,为用户提供流畅的抽奖体验,助力业务顺利开展。本方案将涵盖抽奖活动的整体架构设计、核心流程逻辑、关键功能实现以及…...

Appium+python自动化(十六)- ADB命令

简介 Android 调试桥(adb)是多种用途的工具&#xff0c;该工具可以帮助你你管理设备或模拟器 的状态。 adb ( Android Debug Bridge)是一个通用命令行工具&#xff0c;其允许您与模拟器实例或连接的 Android 设备进行通信。它可为各种设备操作提供便利&#xff0c;如安装和调试…...

微信小程序 - 手机震动

一、界面 <button type"primary" bindtap"shortVibrate">短震动</button> <button type"primary" bindtap"longVibrate">长震动</button> 二、js逻辑代码 注&#xff1a;文档 https://developers.weixin.qq…...

鱼香ros docker配置镜像报错:https://registry-1.docker.io/v2/

使用鱼香ros一件安装docker时的https://registry-1.docker.io/v2/问题 一键安装指令 wget http://fishros.com/install -O fishros && . fishros出现问题&#xff1a;docker pull 失败 网络不同&#xff0c;需要使用镜像源 按照如下步骤操作 sudo vi /etc/docker/dae…...

OpenLayers 分屏对比(地图联动)

注&#xff1a;当前使用的是 ol 5.3.0 版本&#xff0c;天地图使用的key请到天地图官网申请&#xff0c;并替换为自己的key 地图分屏对比在WebGIS开发中是很常见的功能&#xff0c;和卷帘图层不一样的是&#xff0c;分屏对比是在各个地图中添加相同或者不同的图层进行对比查看。…...