did you specify the right host or port? error on Kubernetes

后端 未结 19 1680
北恋
北恋 2020-12-13 12:12

I have followed the helloword tutorial on http://kubernetes.io/docs/hellonode/.

When I run:

kubectl run hello-node --image=gcr.io/PROJECT_ID/hello-node         


        
相关标签:
19条回答
  • 2020-12-13 12:32

    Solution is this:

    minikube delete
    minikube start --vm-driver none
    
    0 讨论(0)
  • 2020-12-13 12:33

    Regardless of your environment (gcloud or not ) , you need to point your kubectl to kubeconfig. By default, kubectl expects the path as $HOME/.kube/config or point your custom path as env variable (for scripting etc ) export KUBECONFIG=/your_kubeconfig_path

    Please refer :: https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/

    If you don't have a kubeconfig file for your cluster, create one by referring :: https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/

    It is required to find cluster's ca.crt , apiserver-kubelet-client key and cert.

    0 讨论(0)
  • 2020-12-13 12:34

    Reproduce the same error when doing a tutorial from Udacity called Scalable Microservices with Kubernetes https://classroom.udacity.com/courses/ud615, at the point of Using Kubernetes, Part 3 of Lesson.

    Launch a Single Instance:

    kubectl run nginx --image=nginx:1.10.0

    Error:

    Unable to connect to the server: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it.

    How I resolved the Error:

    Login to Google Cloud Platform

    Navigate to Container Engine Google Cloud Platform, Container Engine

    Click CONNECT on Cluster

    Use login Credentials to access Cluster [NAME] in your Teminal

    Proceeded With Work!!!

    0 讨论(0)
  • 2020-12-13 12:34

    I was also getting same below error:

    Unable to connect to the server: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it.

    Then I just execute below command and found everything working fine.

    PS C:> .\minikube.exe start

    Starting local Kubernetes v1.10.0 cluster... Starting VM... Downloading Minikube ISO 150.53 MB / 150.53 MB [============================================] 100.00% 0s Getting VM IP address... Moving files into cluster... Downloading kubeadm v1.10.0 Downloading kubelet v1.10.0 Finished Downloading kubelet v1.10.0 Finished Downloading kubeadm v1.10.0 Setting up certs... Connecting to cluster... Setting up kubeconfig... Starting cluster components... Kubectl is now configured to use the cluster. Loading cached images from config file. PS C:> .\minikube.exe start Starting local Kubernetes v1.10.0 cluster... Starting VM... Getting VM IP address... Moving files into cluster... Setting up certs... Connecting to cluster... Setting up kubeconfig... Starting cluster components... Kubectl is now configured to use the cluster.

    0 讨论(0)
  • 2020-12-13 12:36

    try run with sudo permission mode
    example sudo kubectl....

    0 讨论(0)
  • 2020-12-13 12:36

    I was getting an error when running

    sudo kubectl get pods
    The connection to the server localhost:8080 was refused - did you specify the right host or port?
    

    Finally for my environment this command parameter works

    sudo kubectl --kubeconfig /etc/kubernetes/admin.conf get pods
    

    when executing kubectl as non root.

    0 讨论(0)
提交回复
热议问题