我正在按照"Install with Chocolatey on Windows"教程,尝试将kubectl配置为在本地Windows机器上使用远程Kubernetes集群。但是,我不太确定如何填充配置文件。看起来应该像这样:
apiVersion: v1
clusters: []
contexts: []
current-context: ""
kind: Config
preferences: {}
users: []
或者这个,但是我不知道如何填充那些“变量”
apiVersion: v1
clusters:
- cluster:
server: https://123.456.789.123:9999
certificate-authority-data: yourcertificate
name: your-k8s-cluster-name
contexts:
- context:
cluster: your-k8s-cluster-name
namespace: default
user: admin
name: default-context
current-context: default-context
kind: Config
preferences: {}
users:
- name: admin
user:
token: your-login-token
答案 0 :(得分:1)
此变量必须由k8s集群管理员通过特殊的kubeconfig文件提供。
之后,您可以使用--kubeconfig <path to you kubeconfig file>
选项访问群集:
kubectl cluster-info --kubeconfig ./.kube/config -v=7 --insecure-skip-tls-verify=true --alsologtostderr