Kubernetes

lens 添加 k8s 集群

本文主要是介绍lens 添加 k8s 集群,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

官方下载地址:https://k8slens.dev/
github:https://github.com/lensapp/lens

1、找到k8s中的config文件
文件路径

~/.kube/config
cat config
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJeE1Ea3lNREU0TWpVek0xb1hEVE14TURreE9ERTRNalV6TTFvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBUGJVClBnMjZvTTZNL0Zva2MrWkZOQlM1cHVCTnJTMXR3VUVCWTlFc3k4eWxCMmZMZHhWSDdNcUJoTlhRQWFaV0c5NkoKaDBxbHBjTkJsaFlObkw5aU1KRHc2ZmUzcldiSGFGTS9NRUh0bkVid3AvMUJpTk8zSGV3RmR2VUNSc2hYSW9tMgpGdDBMV2xhbFhWZWtWcktxd0F1L0VGT0JwQlVrM3craHBzTTF4NVQyb2lFL3MvK0V3ODRsQkRndlFZYXRDWGNrClF4NWJQbzNEc2dPNDI0UnRPK0hTREZrcXFTN2w0S3V5b0lMaytIR2FOVkF4UU1sODdlLytpOHNreWorY0tWY08KK3p1VVIxV1d0NmtEQjVRQ2RzaXZLRmxCekJhQUZNMlNBRStWalBTRlBxclArQUZBTUxBOVN0WlpDZEp6QzJ1NQpyeitzQ0drMVJHU2NCMUx2RDgwQ0F3RUFBYU1qTUNFd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQkFKWFcrYmZFUkJlY3ZRcDdPSDJzaGR5SERBbTQKRmpBcG5IenBzZTM1WDA1dEpWZERLcGJwWlZzSzgvK2F1NExQeUFIUHJ6SFk1ZFkrRDVSanR0WmtQYVFYaUFWUgpOQmtZQ21wMjdKRHQxcUNlMGQzVm9tMk5obHVXdW1nV3lhSVpjL1U4dE4xTkR1QmNHcDJlRnRFa3NRbWQrdHZhCkkybExoVERMVk04b2o5b2tEdGRONEVqM0FTV1dpWFBQK2wrWGM5RzZiUkVUYlJXRHFFSlZzcnBFdEh3eUNFbTYKeGtocHd4ZUtkV1dIQ2hzR0FqREI3Y2lsTkJNWHQvV3h0bHdveVBLRUszNVNYT2p1OHpqUm1LMHJ3OWZUVUFVWgpscHpIV25NOGNrY3JOWlpWTUhMWjVEeXlEVi8wRE5vRGpTZkcvUmRQTzl1b09oZDRzVG9vVVBTemVIbz0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
    server: https://192.168.200.16: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: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM4akNDQWRxZ0F3SUJBZ0lJWEhqcHZ0d3NzeVV3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TVRBNU1qQXhPREkxTXpOYUZ3MHlNakE1TWpBeE9ESTFNelZhTURReApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sa3dGd1lEVlFRREV4QnJkV0psY201bGRHVnpMV0ZrCmJXbHVNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQTFqVEhJRlFmNFNza1RkdmkKQ0hkWDlDYTBTYUhlaEpqVUxud29vTDVCTVMwTVhaW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Vy9Pc0g1OFV3d1FNVkpWa2w0ZStSaHZUSUR2ME13OW54elBLNG1iSUZzTG5kWTNPVgotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=

2、把这个内容粘贴到lens里面(这个要根据版本,老的版本直接导入文件就行,新的版本需要招贴文件里面的内容就行。)

3、连接集群

4、然后就可以控制集群了


这篇关于lens 添加 k8s 集群的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!