Answer a question

I have a microk8s cluster on a ubuntu laptop. I want to apply a deployment yaml file on it from azure devops pipeline.

I have successfully defined a Kubernetes Service connections in my devops and it went through verification. Though when I try to apply the yaml file I get these lines

/usr/bin/kubectl apply -f /home/vsts/work/1/s/devops/deploymen.yaml -o json


##[error]Unable to connect to the server: x509: certificate is valid for 127.0.0.1, 10.152.183.1, 192.168.50.69, 172.17.0.1, 10.1.80.0, not <my external IP>

192.168.50.69 is the ip of the laptop in my network

Where should I add my external IP?

EDIT :

I found Authentication and authorization and I edited /var/snap/microk8s/current/certs/csr.conf.template so it includes my IP now.

The article says :

After changing, the apiserver-kicker will automatically detect the difference, generate new certs and restart the apiserver. Your DNS server settings and kubeconfig file must be updated appropriately.

The certificate in certificate-authority-data /var/snap/microk8s/current/certs/ca.crt now looks different than the one from microk8s config

I also updated kubeconfig with as mentioned above

But still no luck !

Answers

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.

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐