problem with kubectl command

This is part of "Kubernetes the Hard Way" , Lecture: Configuring Kubectl for Remote Access.  I get the following after i configure my context:

thor:kthw mikron$ kubectl get nodes

Unable to connect to the server: x509: certificate is valid for docker-for-desktop, kubernetes, kubernetes.default, kubernetes.default.svc, kubernetes.default.svc.cluster.local, host.docker.internal, not localhost

thor:kthw mikron$ kubectl get pods

Unable to connect to the server: x509: certificate is valid for docker-for-desktop, kubernetes, kubernetes.default, kubernetes.default.svc, kubernetes.default.svc.cluster.local, host.docker.internal, not localhost

thor:kthw mikron$ kubectl version

Client Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.2", GitCommit:"17c77c7898218073f14c8d573582e8d2313dc740", GitTreeState:"clean", BuildDate:"2018-10-30T21:39:16Z", GoVersion:"go1.11.1", Compiler:"gc", Platform:"darwin/amd64"}

Unable to connect to the server: x509: certificate is valid for docker-for-desktop, kubernetes, kubernetes.default, kubernetes.default.svc, kubernetes.default.svc.cluster.local, host.docker.internal, not localhost

thor:kthw mikron$ kubectl --server=localhost:6443 get pods

Unable to connect to the server: net/http: HTTP/1.x transport connection broken: malformed HTTP response "\x15\x03\x01\x00\x02\x02"


I could use some help with troubleshooting


Thanks,


Mike



  • post-author-pic
    Will B
    11-12-2018

    It looks like a problem with your Kubernetes API server cert. Did you set up your cluster on linux academy cloud servers, or somewhere else? It's weird that the certs are signed for "docker-for-desktop."


    Check out the video Generating the Kubernetes API Server Certificate. Your Kube api server cert needs to be signed for a bunch of stuff, including 127.0.0.1 and localhost.

  • post-author-pic
    Michael K
    11-19-2018

    I figured this out, and the solution was funny.  I had Docker with kubernetes enabled running on my mac, and it was affecting my kube environment.  Once I quit docker, everything worked.  Thanks.

  • post-author-pic
    Will B
    11-19-2018

    Awesome! Glad to hear you found the solution!

Looking For Team Training?

Learn More