error: couldn't read version from server

后端 未结 6 2151
旧巷少年郎
旧巷少年郎 2021-02-13 13:12

I am getting the following error when trying to run kubectl locally.

error: couldn\'t read version from server: Get http://localhost:8080/api: dial tc

6条回答
  •  星月不相逢
    2021-02-13 13:45

    I also got this error when deploying locally with a mostly default configuration on Ubuntu Trusty. Turns out the api-server was not starting due to some bug with DenyEscalatingExec particular to ubuntu in k8s v1.1.7

    https://github.com/kubernetes/kubernetes/issues/14474 https://github.com/kubernetes/kubernetes/issues/14627

    I rebuilt the cluster without it by removing the directive from the file ~/kubernetes-1.1.7/cluster/ubuntu/config-default.sh before executing kube-up.sh

    # Admission Controllers to invoke prior to persisting objects in cluster
    export ADMISSION_CONTROL=NamespaceLifecycle,LimitRanger,ServiceAccount,ResourceQuota,DenyEscalatingExec,SecurityContextDeny
    

    DenyEscalatingExec needs to be removed from that line, and as a result, it won't be a flag in your /etc/default/kube-apiserver after starting the cluster.

    Disclaimer: I'm not sure what DenyEscalatingExec does, I just found that this worked for me to solve this particular problem.

提交回复
热议问题