skip to Main Content

I created a kubernetes cluster on my debian 9 machine using kind.
Which apparently works because I can run kubectl cluster-info with valid output.

Now I wanted to fool around with the tutorial on Learn Kubernetes Basics site.

I have already deployed the app

kubectl create deployment kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1

and started the kubectl proxy.

Output of kubectl get deployments

NAME                  READY   UP-TO-DATE   AVAILABLE   AGE
kubernetes-bootcamp   1/1     1            1           17m

My problem now is: when I try to see the output of the application using curl I get

Error trying to reach service: ‘dial tcp 10.244.0.5:80: connect: connection refused’

My commands

export POD_NAME=$(kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"n"}}{{end}}')
curl http://localhost:8001/api/v1/namespaces/default/pods/$POD_NAME/proxy/

For the sake of completeness I can run curl http://localhost:8001/api/v1/namespaces/default/pods/$POD_NAME/ and I get valid output.

3

Answers


  1. The steps from this tutorial module represent environment as if You were working on one of the cluster nodes.

    And the command tries to check connectivity to service locally on the node.

    However In Your case by running Your kubernetes in a docker (kind) cluster the curl command is most likely ran from the host that is serving the docker containers that have kubernetes in it.

    It might be possible to use docker exec to get inside kind node and try to run curl command from there.

    Hope this helps.

    Login or Signup to reply.
  2. I’m also doing following the tutorial using kind and got it to work forwarding the port:

     kubectl port-forward $POD_NAME 8001:8001
    
    Login or Signup to reply.
  3. Try add :8080 after the $POD_NAME

     curl http://localhost:8001/api/v1/namespaces/default/pods/$POD_NAME:8080/proxy/
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search