我正在尝试遵循本教程https://www.youtube.com/watch?v=9EUyMjR6jSc。我正在使用 Ubuntu 20.04LTS,我安装了 k3d,这是 ~/.kube/config 信息
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: ...
server: https://192.168.0.13:16443
name: k3d-dev
contexts:
- context:
cluster: k3d-dev
user: admin@k3d-dev
name: k3d-dev
current-context: k3d-dev
kind: Config
preferences: {}
users:
- name: admin@k3d-dev
user:
client-certificate-data:...
client-key-data:...
Docker 版本是 Version: 20.10.2
. 根据教程,我需要运行一个 halyard 容器,并且在容器内我可以访问本地 kubernetes(在本例中为 k3d)。halyard 容器带有 kubectl,所以我只需要使用上述信息创建一个 ~/.kube/config,但我仍然收到 Unable to connect to server 消息。如果我运行 kubectl cluster-info,集群就会启动并运行
Kubernetes control plane is running at https://192.168.0.13:16443
CoreDNS is running at https://192.168.0.13:16443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Metrics-server is running at https://192.168.0.13:16443/api/v1/namespaces/kube-system/services/https:metrics-server:/proxy
在升降索容器内
bash-5.0$ kubectl version
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.10", GitCommit:"1bea6c00a7055edef03f1d4bb58b773fa8917f11", GitTreeState:"clean", BuildDate:"2020-02-11T20:13:57Z", GoVersion:"go1.12.12", Compiler:"gc", Platform:"linux/amd64"}
Unable to connect to the server: dial tcp 192.168.0.13:16443: i/o timeout
bash-5.0$ kubectl config view
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: DATA+OMITTED
server: https://192.168.0.13:16443
name: k3d-dev
contexts:
- context:
cluster: k3d-dev
user: admin@k3d-dev
name: k3d-dev
current-context: k3d-dev
kind: Config
preferences: {}
users:
- name: admin@k3d-dev
user:
client-certificate-data: REDACTED
client-key-data: REDACTED
bash-5.0$ kubectl config current-context
k3d-dev