Kubeconfig中的certificate-authority
、client-certificate
和client-key
都指的是某个具体文件路径,如何转化成数据格式的呢?
比如:
apiVersion: v1
kind: Config
clusters:
- cluster:
certificate-authority: */ca.crt
server: https://******
name: demo
contexts:
- context:
cluster: demo
user: demo
name: demo
current-context: demo
preferences: {}
users:
- name: demo
user:
client-certificate: */client.crt
client-key: */client.key
将证书文件进行
base64
编码:OS X
cat "证书文件" | base64
Linux
cat "证书文件" | base64
Windows
certutil -f -encode "证书文件" "输出文件"
然后更新 Kubeconfig 文件
将
certificate-authority
改为certificate-authority-data
,并且将*/ca.crt
证书文件经base64
编码后的字符串填入该位置。以此类推,注意加
-data
。完美
你的答案