K8s-kubectl远程管理集群

简介: K8s-kubectl远程管理集群

在实际工作中,我们有一个需求,需要远程登陆管理集群。其实不用非要登录k8s-master去敲命令,可以使用任意一台内网互通的机器安装kubectl命令,去远程管理集群,非常方便


1.安装kubectl


cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF
#重建yum缓存,输入y添加证书认证
yum makecache fast
yum install -y  kubectl-1.18.4 
#安装集群管理命令


2.查看master节点的集群配置文件


cat .kube/config 
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJeE1EVXlNekV5TURnME1Wb1hEVE14TURVeU1URXlNRGcwTVZvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTU1MCituVDh1ekUrMGtiWEtVcmZscTQyTmpPdTZramNzenA0RHViNjZ1R0VuVkc0RXRaNTBYenJWSVNQL2ZMQWFNc0IKbFVuRXArSWhDeExueFJFOW5QOENJQWh4WEx5RGx4azJUYTgvc3Ezb3JaM3I5Z2J5d0pYdCtCNXVRMS80dW13QQp6RWZzazNQQ2VZaHBncHdsY3FUOXZEVUVmdS82ME9EOEQ3aHFSc09kVnJoY3UvUjA0RkpFQnZOQTZkNmhFWDhKCmJVZk9PNVRNTUszbWF1cCt3VG15ZERDbk56U2dsMHRFV1NFUGpLMEZZVlVQaXphS1lFVE1jd0JsbkNmU21sbHkKY0ZGY3FOcXpBVXFmSTVaMEtVRDFLZWQ0ZUF5L1MrS2JoZnVaMWxZdnBQcjhEWXRhWURxMytWY3hENFJmRFllaQpiWVFiOXRVVGVKbi9jb2RqSDFVQ0F3RUFBYU1qTUNFd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQkFKaWxMWE9DbysvVVF3aWFVUmJTSmNFZkc0Vy8KNkY4ekxtdGhSZHlRNjU3Wm9ORFNZNnBld1ZWTVA3Y2M2QzJETTJUK3RzZFNDbjRZQ3BXbXpndDNtWFJkdWVzVwpyUit5ODJRSkJsVDFESnhCUWtRc3pGMGNnVGJKWVJ0UFEwdENWV09RMjMxR1pIVk1DNDNhdE9sMnVDbnliOHJPCjBxYnVoNnJjZzM2TWRDaENVWko5WFFwdTlVK1NqcnJBWm5PSTlZMVBFUTBaaEZiSGJwTnJjT3RTYXpRaFJNMHcKa0NWcDIyQU0xVllNWHZ1bG5RQjNoZm9McTZsY1VaZm5BdUdTNXhFNEc0YXczYktOL1JxZmpuQzRiTGtuRWZzdwpYbk9XeVY2d3gwSmtrUnlNaEkxL09XNlVJWEtzZUhNb3dPckI0VHEvc2xJTXh0SlJWMkhqZTgyUDBHdz0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
    server: https://192.168.26.150:16443
  name: kubernetes
contexts:
- context:
    cluster: kubernetes
    user: kubernetes-admin
  name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
  user:
    client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM4akNDQWRxZ0F3SUJBZ0lJV1l4N2NaaFBLUzR3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWV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EN1b0VPbXB1cUpSRTU3a3hORjQ1OGQxKzRFYUNRdDNwUHBDb25qRXFad2xjbjZoenUwdkxSM0hjCjZVeFh5UUtCZ0RnZURGVldoWGlUOVdIRUZYY0hSK0Q1WG5QYWFqZnZLaWYrK1EySXNObHJ1MjZpdWxLYjRCVUEKK2VWZ1V4WFladlRkZHNCSkVvVDlpRnF4Z3puWjl2RUhZa05VMlNNczQwd1RYRlE0U202cmF6UDFFOGVHRVJoTQozM0Q2aFpPWDNYVWpkVzFXZVZSMVhJVWFSTEE1a1JpRlQ0ZzFQMEhtVmNJcnBGUDFadHRsCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==


3.在远程管理机器上创建配置文件


mkdir -p $HOME/.kube
vim .kube/config


拷贝master节点的配置文件或者scp过去都行

[root@localhost ~]# cat .kube/config
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJeE1EVXlNekV5TURnME1Wb1hEVE14TURVeU1URXlNRGcwTVZvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTU1MCituVDh1ekUrMGtiWEtVcmZscTQyTmpPdTZramNzenA0RHViNjZ1R0VuVkc0RXRaNTBYenJWSVNQL2ZMQWFNc0IKbFVuRXArSWhDeExueFJFOW5QOENJQWh4WEx5RGx4azJUYTgvc3Ezb3JaM3I5Z2J5d0pYdCtCNXVRMS80dW13QQp6RWZzazNQQ2VZaHBncHdsY3FUOXZEVUVmdS82ME9EOEQ3aHFSc09kVnJoY3UvUjA0RkpFQnZOQTZkNmhFWDhKCmJVZk9PNVRNTUszbWF1cCt3VG15ZERDbk56U2dsMHRFV1NFUGpLMEZZVlVQaXphS1lFVE1jd0JsbkNmU21sbHkKY0ZGY3FOcXpBVXFmSTVaMEtVRDFLZWQ0ZUF5L1MrS2JoZnVaMWxZdnBQcjhEWXRhWURxMytWY3hENFJmRFllaQpiWVFiOXRVVGVKbi9jb2RqSDFVQ0F3RUFBYU1qTUNFd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQkFKaWxMWE9DbysvVVF3aWFVUmJTSmNFZkc0Vy8KNkY4ekxtdGhSZHlRNjU3Wm9ORFNZNnBld1ZWTVA3Y2M2QzJETTJUK3RzZFNDbjRZQ3BXbXpndDNtWFJkdWVzVwpyUit5ODJRSkJsVDFESnhCUWtRc3pGMGNnVGJKWVJ0UFEwdENWV09RMjMxR1pIVk1DNDNhdE9sMnVDbnliOHJPCjBxYnVoNnJjZzM2TWRDaENVWko5WFFwdTlVK1NqcnJBWm5PSTlZMVBFUTBaaEZiSGJwTnJjT3RTYXpRaFJNMHcKa0NWcDIyQU0xVllNWHZ1bG5RQjNoZm9McTZsY1VaZm5BdUdTNXhFNEc0YXczYktOL1JxZmpuQzRiTGtuRWZzdwpYbk9XeVY2d3gwSmtrUnlNaEkxL09XNlVJWEtzZUhNb3dPckI0VHEvc2xJTXh0SlJWMkhqZTgyUDBHdz0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
    server: https://192.168.26.150:16443
  name: kubernetes
contexts:
- context:
    cluster: kubernetes
    user: kubernetes-admin
  name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
  user:
    client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM4akNDQWRxZ0F3SUJBZ0lJV1l4N2NaaFBLUzR3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUU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2cWxMMG55YnR1cllnWQp1QjM2amY0ZEN1b0VPbXB1cUpSRTU3a3hORjQ1OGQxKzRFYUNRdDNwUHBDb25qRXFad2xjbjZoenUwdkxSM0hjCjZVeFh5UUtCZ0RnZURGVldoWGlUOVdIRUZYY0hSK0Q1WG5QYWFqZnZLaWYrK1EySXNObHJ1MjZpdWxLYjRCVUEKK2VWZ1V4WFladlRkZHNCSkVvVDlpRnF4Z3puWjl2RUhZa05VMlNNczQwd1RYRlE0U202cmF6UDFFOGVHRVJoTQozM0Q2aFpPWDNYVWpkVzFXZVZSMVhJVWFSTEE1a1JpRlQ0ZzFQMEhtVmNJcnBGUDFadHRsCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==


注意一点 我这里是内网互通环境,用域名的记得配置hosts主机解析,没有尝试过外网ip效果,小伙子们可以试试!


4.测试效果


[root@localhost ~]# kubectl get nodes
NAME     STATUS                     ROLES         AGE    VERSION
k8s-01   Ready                      master,node   2d2h   v1.18.14
k8s-02   Ready                      master,node   2d2h   v1.18.14
k8s-03   Ready,SchedulingDisabled   node          2d2h   v1.18.14
k8s-04   Ready
[root@localhost ~]# kubectl taint nodes k8s-01 node-role.kubernetes.io/master=:NoSchedule
node/k8s-01 tainted
[root@localhost ~]# kubectl get nodes
NAME     STATUS                     ROLES         AGE    VERSION
k8s-01   Ready                      master,node   2d2h   v1.18.14
k8s-02   Ready                      master,node   2d2h   v1.18.14
k8s-03   Ready,SchedulingDisabled   node          2d2h   v1.18.14
k8s-04   Ready                      master,node   2d2h   v1.18.14


正常管理集群成功

相关实践学习
通过Ingress进行灰度发布
本场景您将运行一个简单的应用,部署一个新的应用用于新的发布,并通过Ingress能力实现灰度发布。
容器应用与集群管理
欢迎来到《容器应用与集群管理》课程,本课程是“云原生容器Clouder认证“系列中的第二阶段。课程将向您介绍与容器集群相关的概念和技术,这些概念和技术可以帮助您了解阿里云容器服务ACK/ACK Serverless的使用。同时,本课程也会向您介绍可以采取的工具、方法和可操作步骤,以帮助您了解如何基于容器服务ACK Serverless构建和管理企业级应用。 学习完本课程后,您将能够: 掌握容器集群、容器编排的基本概念 掌握Kubernetes的基础概念及核心思想 掌握阿里云容器服务ACK/ACK Serverless概念及使用方法 基于容器服务ACK Serverless搭建和管理企业级网站应用
目录
相关文章
|
13天前
|
Kubernetes 监控 Cloud Native
Kubernetes集群的高可用性与伸缩性实践
Kubernetes集群的高可用性与伸缩性实践
46 1
|
2月前
|
JSON Kubernetes 容灾
ACK One应用分发上线:高效管理多集群应用
ACK One应用分发上线,主要介绍了新能力的使用场景
|
2月前
|
Kubernetes 持续交付 开发工具
ACK One GitOps:ApplicationSet UI简化多集群GitOps应用管理
ACK One GitOps新发布了多集群应用控制台,支持管理Argo CD ApplicationSet,提升大规模应用和集群的多集群GitOps应用分发管理体验。
|
2月前
|
Kubernetes Ubuntu Linux
Centos7 搭建 kubernetes集群
本文介绍了如何搭建一个三节点的Kubernetes集群,包括一个主节点和两个工作节点。各节点运行CentOS 7系统,最低配置为2核CPU、2GB内存和15GB硬盘。详细步骤包括环境配置、安装Docker、关闭防火墙和SELinux、禁用交换分区、安装kubeadm、kubelet、kubectl,以及初始化Kubernetes集群和安装网络插件Calico或Flannel。
166 4
|
2月前
|
Kubernetes Cloud Native 云计算
云原生之旅:Kubernetes 集群的搭建与实践
【8月更文挑战第67天】在云原生技术日益成为IT行业焦点的今天,掌握Kubernetes已成为每个软件工程师必备的技能。本文将通过浅显易懂的语言和实际代码示例,引导你从零开始搭建一个Kubernetes集群,并探索其核心概念。无论你是初学者还是希望巩固知识的开发者,这篇文章都将为你打开一扇通往云原生世界的大门。
128 17
|
2月前
|
Kubernetes 应用服务中间件 nginx
搭建Kubernetes v1.31.1服务器集群,采用Calico网络技术
在阿里云服务器上部署k8s集群,一、3台k8s服务器,1个Master节点,2个工作节点,采用Calico网络技术。二、部署nginx服务到k8s集群,并验证nginx服务运行状态。
646 1
|
2月前
|
Kubernetes Cloud Native 流计算
Flink-12 Flink Java 3分钟上手 Kubernetes云原生下的Flink集群 Rancher Stateful Set yaml详细 扩容缩容部署 Docker容器编排
Flink-12 Flink Java 3分钟上手 Kubernetes云原生下的Flink集群 Rancher Stateful Set yaml详细 扩容缩容部署 Docker容器编排
77 3
|
2月前
|
Kubernetes Cloud Native 微服务
微服务实践之使用 kube-vip 搭建高可用 Kubernetes 集群
微服务实践之使用 kube-vip 搭建高可用 Kubernetes 集群
116 1
|
2月前
|
负载均衡 应用服务中间件 nginx
基于Ubuntu-22.04安装K8s-v1.28.2实验(二)使用kube-vip实现集群VIP访问
基于Ubuntu-22.04安装K8s-v1.28.2实验(二)使用kube-vip实现集群VIP访问
59 1
|
2月前
|
Kubernetes Cloud Native Ubuntu
云原生之旅:Kubernetes集群搭建与应用部署
【8月更文挑战第65天】本文将带你进入云原生的世界,通过一步步指导如何在本地环境中搭建Kubernetes集群,并部署一个简单的应用。我们将使用Minikube和Docker作为工具,探索云原生技术的魅力所在。无论你是初学者还是有经验的开发者,这篇文章都将为你提供有价值的信息和实践技巧。