第一步,必须准备好要连接/使用的K8S的配置文件,笔者给出一份杜撰的配置: apiVersion:v1clusters:-cluster:certificate-authority-data:thisisfakecertifcateauthoritydata00000000000server:https://1.2.3.4:1234name:cls-devcontexts:-context:cluster:cls-devuser:kubernetes-adminname:kubernetes-admin@testcurrent-context...
[root@master01 work ]#kubectl config set-credentials admin --client-certificate=admin.pem --client-key=admin-key.pem --embed-certs=true --kubeconfig=kube.configUser “admin” set.[root@master01 work ]#cat kube.config apiVersion: v1 clusters: - cluster: certificate-authority-data: LS0tLS...
┌──[root@vms81.liruilongs.github.io]-[~/.kube]└─$kubectlconfig view -o json|jq .clusters[{"name":"kubernetes","cluster":{"server":"https://192.168.26.81:6443","certificate-authority-data":"DATA+OMITTED"}}] 创建工作组对应的命名空间 ┌──[root@vms81.liruilongs.github.io]-[~...
client-certificate-data: REDACTED # 客户端证书 client-key-data: REDACTED # 客户端密钥 总结: 一个config主要包含了三部分内容:users、clusters、contexts,每个部分都有两部分组成: name和user|cluster|context 对于cluster,对外的地址-server 和 基本的认证方式-certificate-authority-data 对于context,连接到的集群-...
authority-data:DATA+OMITTEDserver:https://192.168.110.130:6443name:kubernetescontexts:-context:cluster:kubernetesuser:kubernetes-adminname:kubernetes-admin@kubernetescurrent-context:kubernetes-admin@kuberneteskind:Configpreferences:{}users:-name:kubernetes-adminuser:client-certificate-data:REDACTEDclient-key-data:...
certificate-authority-data: DATA+OMITTED server: https://192.168.0.41:6443 name: kubernetes contexts: - context: cluster: kubernetes user: kubernetes-admin name: kubernetes-admin@kubernetes current-context: kubernetes-admin@kubernetes kind: Config ...
certificate-authority-data: DATA+OMITTED server: https://192.168.4.170:6443 name: kubernetes contexts: - context: cluster: kubernetes user: kubernetes-admin name: kubernetes-admin@kubernetes current-context: kubernetes-admin@kubernetes kind: Config ...
certificate-authority-data: DATA+OMITTED server: https://10.31.90.200:8443 name: k8s contexts: - context: cluster: k8s user: billy name: billy@k8s current-context: "" kind: Config preferences: {} users: - name: billy user: client-certificate-data: REDACTED ...
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUMvakNDQWVhZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJeU1EUXdOekUzTWprd05Wb1hEVE15TURRd05ERTNNamt3TlZvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSW...
# 查看kubectl上下文配置[root@~/custom]# kubectl config viewapiVersion:v1clusters:-cluster:certificate-authority-data:DATA+OMITTEDserver:https://9.215.152.23:60002name:localcontexts:-context:cluster:localuser:adminname:master current-context:masterkind:Configpreferences:{}users:-name:adminuser:token:**...