0

I have created "helloworld" application in python and dockerised it and pushed my image in docker hub repository. Then deployed it in kubernetes dashboard.

service in kubernetes

This is my yaml file

    {
  "kind": "Service",
  "apiVersion": "v1",
  "metadata": {
    "name": "helloworld2",
    "namespace": "default",
    "selfLink": "/api/v1/namespaces/default/services/helloworld2",
    "uid": "d522c798-3639-11e9-9694-0800278c22c8",
    "resourceVersion": "16642",
    "creationTimestamp": "2019-02-22T00:36:02Z",
    "labels": {
      "k8s-app": "helloworld2"
    }
  },
  "spec": {
    "ports": [
      {
        "name": "tcp-30001-8080-ljs7r",
        "protocol": "TCP",
        "port": 30001,
        "targetPort": 8080,
        "nodePort": 30935
      }
    ],
    "selector": {
      "k8s-app": "helloworld2"
    },
    "clusterIP": "10.107.196.133",
    "type": "NodePort",
    "sessionAffinity": "None",
    "externalTrafficPolicy": "Cluster"
  },
  "status": {
    "loadBalancer": {}
  }
}

When i try to access my service i am getting this

Site cannot be reached

Don't know what I am missing. Please help

  • Can you provide more information about your deployment? Where do you run the cluster, I suppose locally. What is the output of `kubectl get endpoints`? – Alex Simenduev Mar 07 '19 at 01:21
  • Yes. I am running it locally. kubectl get endpoints gives 172.17.0.8:8080 – Praveen Xavier Mar 07 '19 at 01:54
  • 3
    @Praveen Is this a Windows machine where your K8s cluster is running? If so, I'm not sure but someone on stackoverflow told me that Nodeport services don't work on Windows. – Gaurav Gahlot Mar 07 '19 at 02:39
  • @GauravGahlot Yes. I am using windows 7 machine. Is that could be a reason? I tried all possible ways. But didn't work. – Praveen Xavier Mar 07 '19 at 09:58

0 Answers0