在Windows上使用Kubectl客户端(1.7.0)连接到远程群集。
Windows(位于.kube)目录中的配置文件配置如下:
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: C:\Users\DK05478\.kube\ca.crt
server: https://10.99.70.153:6443
name: devo
contexts:
- context:
cluster: devo
user: admindevo
name: devo
current-context: devo
kind: Config
preferences: {}
users:
- name: admindevo
user:
client-certificate-data: C:\Users\DK05478\.kube\apiserver.crt
client-key-data: C:\Users\DK05478\.kube\apiserver.key
我从远程系统下载到我的localhost的这些证书文件。但这不起作用。引发以下错误 - >
C:\Windows\kubernetes>kubectl version
Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.0", GitCommit:"d3ada0119e776222f11ec7945e6d860061339aad", GitTreeState:"clean", BuildDate:"2017-06-29T23:15:59Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"windows/amd64"}
error: Error loading config file "C:\Users\DK05478/.kube/config": [pos 107]: json: error decoding base64 binary 'C:\Users\DK05478\.kube\ca.crt': illegal base64 data at input byte 1
如何解决此问题?什么是我做错了?
答案 0 :(得分:1)
从-data
,certificate-authority-data
和client-certificate-data
中删除client-key-data
后缀。与@sfgroups所说的一样,xxx-data
param用于base64编码的证书/密钥。
完成后,您的kubeconfig应如下所示:
apiVersion: v1
clusters:
- cluster:
certificate-authority: C:\Users\DK05478\.kube\ca.crt
server: https://10.99.70.153:6443
name: devo
contexts:
- context:
cluster: devo
user: admindevo
name: devo
current-context: devo
kind: Config
preferences: {}
users:
- name: admindevo
user:
client-certificate: C:\Users\DK05478\.kube\apiserver.crt
client-key: C:\Users\DK05478\.kube\apiserver.key
答案 1 :(得分:0)
certificate-authority-data: , client-certificate-data:, client-key-data:
引用该文件。我认为你需要base64编码键值。您可以查看群集主文件中的.kube/config
文件。
查看base64
用法示例https://kubernetes.io/docs/concepts/configuration/secret/