2021-05-07使用powershell连接k8s集群

想使用window的powershell连接云主机的k8s集群进行开发,按照下面的步骤进行,配置kubeconfig
https://www.yuque.com/xiongsanxiansheng/nlrnxo/lm4htv
但是ip要修改
clusters:

  • cluster:
    insecure-skip-tls-verify: true
    server: https://{IP}:6443
    name: cluster.local

修改成自己的地址
但是修改后显示
Unable to connect to the server: x509: certificate is valid for <internal IPs>, not <external IP>,然后我去查了一下,在Stack Overflow看到了解决办法
Unable to connect to the server: x509: certificate is valid for <internal IPs>, not <external IP>
就是跳过验证,改为

- cluster:
    insecure-skip-tls-verify: true
    server: https://<master_ip>:<port>

原文解决方法,如下
I reproduced your issue and the solution seems to be either adding certificate in kubeconfig file or to skip tls verification.

You can do it by adding insecure-skip-tls-verify: true to kubeconfig file so it look something like this:

- cluster:
    insecure-skip-tls-verify: true
    server: https://<master_ip>:<port>

or modify kubeconfig on your microk8s cluster and change server: https://127.0.0.1:16443 to server: https://<master_ip>:16443 and copy it to the host you want to access cluster from.

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容