在实际工作中,我们有一个需求,需要远程登陆管理集群。其实不用非要登录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: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM4akNDQWRxZ0F3SUJBZ0lJV1l4N2NaaFBLUzR3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TVRBMU1qTXhNakE0TkRGYUZ3MHlNakExTWpNeE1qQTRORE5hTURReApGekFWQmdOVk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xSM0hjCjZVeFh5UUtCZ0RnZURGVldoWGlUOVdIRUZYY0hSK0Q1WG5QYWFqZnZLaWYrK1EySXNObHJ1MjZpdWxLYjRCVUEKK2VWZ1V4WFladlRkZHNCSkVvVDlpRnF4Z3puWjl2RUhZa05VMlNNczQwd1RYRlE0U202cmF6UDFFOGVHRVJoTQozM0Q2aFpPWDNYVWpkVzFXZVZSMVhJVWFSTEE1a1JpRlQ0ZzFQMEhtVmNJcnBGUDFadHRsCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==
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: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM4akNDQWRxZ0F3SUJBZ0lJV1l4N2NaaFBLUzR3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TVRBMU1qTXhNakE0TkRGYUZ3MHlNakExTWpNeE1qQTRORE5hTURReApGekFWQmdOV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kxSM0hjCjZVeFh5UUtCZ0RnZURGVldoWGlUOVdIRUZYY0hSK0Q1WG5QYWFqZnZLaWYrK1EySXNObHJ1MjZpdWxLYjRCVUEKK2VWZ1V4WFladlRkZHNCSkVvVDlpRnF4Z3puWjl2RUhZa05VMlNNczQwd1RYRlE0U202cmF6UDFFOGVHRVJoTQozM0Q2aFpPWDNYVWpkVzFXZVZSMVhJVWFSTEE1a1JpRlQ0ZzFQMEhtVmNJcnBGUDFadHRsCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==
注意一点 我这里是内网互通环境,用域名的记得配置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
正常管理集群成功