堕落不振功业废,勤耕不辍日月新

CentOS搭建k8s集群(11)—node节点使用kubectl命令

综合 hailen 16℃

使用kubectl命令,需要访问kube-apiserver,而访问kube-apiserver需要对身份进行认证
将主节点下的/root/.kube/config文件放到工作节点的相同目录下

config文件内容:

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM1ekNDQWMrZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJd01URXdOREV6TWpNME9Wb1hEVE13TVRFd01qRXpNak0wT1Zvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTWg4CmRuNXR0VUdqdktvMHZoeE9mazBLbUFlSWhjeXBXNXhzNk00SjE0UUhXUnJnakVzczdyWnVFLzlSU0VXdS84MUUKek9hT0FSZ3ptbHc0Z05SNW9GRTlyUTBabSs4RGJUdy9lejJ5L3FDVEdDdnVmTVc3Y0xXWEFjWHRlNVQ0ajQvNQpOY1ZZS2tIQWt1N2hBbzJSVVUwQTlTOXRBQnlpRjFjZjdZbUpnSFRVQWh5TFRucVZBOVVvN3VVVmdRckhEdlpECm9GMXVVN0RHREYrYWFQdDRFQ3hjam1QK1h4bWIxYXMrRzNpTjJ5VE5qME1sSWt0MDJTakMzd0c4ME96UE1SVUQKb0ljWjRBdGk4MlgvSlllMXJIcWxYNThTMGgzVDlGangveGw5eXh4bDFmZU1XbFQ4TXl4OHpINXFOYmUwMThidApEdW5zUXFwK3BCT1VNUXpZMTBzQ0F3RUFBYU5DTUVBd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0hRWURWUjBPQkJZRUZEUkpyU3hEMWlxTXVuaWZKVG11N0JwdmJ1ajlNQTBHQ1NxR1NJYjMKRFFFQkN3VUFBNElCQVFBWDVCNHZjYUF5USt5Y1cvRWtMajVMcU9XMEliV2dIVWplb2V5Zkd1TTZyMVJQeTFMLwprN1RIQ0hoeGRZVEI4OHAxN3RaZm1aK082VlNyS3NtN01CWFA4R2k3amFDR0ZwRnlNNW9uc0tscmE5eDFXRXVkCnVUdzRtMlpJVys3U3N6RVpBa3hjcDUwWUJpc1JteFBWaEtUa0JmdlJSY1M3K05uT2pxblZ2cnl2a0pYUXY2RjMKS2xhRGlGN3dTZXNxaXQ2aitiVEhUeW5iMmVQdy9lN2Y5SE5YanZrNmJ2MnhwSmNaYUtSczVObE45cVNNaUZRVgppNzdsQUxDSHd3d2dqNXN2VmRrQzNFQmJGbTM1T3hVR2pCYzBrYjR3SkZHYTM0S3hzK25IRXdob21BRWI0RHkrClR6ZTltOHExalowTnQ0Ui9SbGFYekNXZWNmdzd3ZXpGYTd3WgotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
    server: https://192.168.201.1:6443
  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: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURFekNDQWZ1Z0F3SUJBZ0lJVHMwZHA5akFHbTh3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TURFeE1EUXhNekl6TkRsYUZ3MHlNVEV4TURReE16SXpOVE5hTURReApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sa3dGd1lEVlFRREV4QnJkV0psY201bGRHVnpMV0ZrCmJXbHVNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQSs0blJEV1ZJaS91SHZNTk0KckkyZX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bVlMRlJBQlJQb21KNDVJZXNVdFkreERVUGFRMnVRTlI1RWdmUFlINVRSSkhRTWI5S3IxUAp5cGZmN2FnNjlxeDNObjFCRDUwaHBqMU1MWlFDQWJsUFExTzhJWUIycDFGOGswLzluNGNyUFVZPQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=

参考资料:
https://www.cnblogs.com/xingyys/p/11660881.html

转载请注明:我是IT » CentOS搭建k8s集群(11)—node节点使用kubectl命令

喜欢 (0)or分享 (0)