简体   繁体   中英

Error while running kubectl commands

I have recently installed minikube and kubectl. However when I run kubectl get pods or any other command related to kubectl I get the error

Unable to connect to the server: unexpected EOF

Does anyone know how to fix this?I am using Ubuntu server 16.04.Thanks in advance.

The following steps can be used for further debugging.

  1. Check the minikube local cluster status using minikube status command.

     $: minikube status minikube: Running cluster: Running kubectl: Correctly Configured: pointing to minikube-vm at 172.0.xy
  2. If problem with kubectl configuratuion,then configure it using, kubectl config use-context minikube command.

     $: kubectl config use-context minikube Switched to context "minikube".
  3. Check the cluster status, using kubectl cluster-info command.

     $: kubectl cluster-info Kubernetes master is running at ... Heapster is running at ... KubeDNS is running at ... ... To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

Note: It can even be due to very simple reason: internet speed (it happend to me just now).

I have same problem too. I solved after change the server addr to localhost

  apiVersion: v1
  clusters:
  - cluster:
      certificate-authority: /var/lib/minikube/certs/ca.crt
      server: https://localhost:8443 # check it 
    name: m01
...
  users:
  - name: m01
    user:
      client-certificate: /var/lib/minikube/certs/apiserver.crt
      client-key: /var/lib/minikube/certs/apiserver.key

I think your kubernetes master is not setup properly. You can check that by checking the following services in master node are in active state and running.

etcd2.service 
kube-apiserver.service          Kubernetes API Server
kube-controller-manager.service Kubernetes Controller Manager
kube-scheduler.service          Kubernetes Scheduler 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM