Configuring TCP services with nginx ingress on minikube/k8s Announcing the arrival of Valued...

Did Krishna say in Bhagavad Gita "I am in every living being"

Trademark violation for app?

Significance of Cersei's obsession with elephants?

Can the Great Weapon Master feat's "Power Attack" apply to attacks from the Spiritual Weapon spell?

Why aren't air breathing engines used as small first stages?

Project Euler #1 in C++

How were pictures turned from film to a big picture in a picture frame before digital scanning?

How can I reduce the gap between left and right of cdot with a macro?

Why is it faster to reheat something than it is to cook it?

Effects on objects due to a brief relocation of massive amounts of mass

Why weren't discrete x86 CPUs ever used in game hardware?

Do I really need to have a message in a novel to appeal to readers?

Disembodied hand growing fangs

How could we fake a moon landing now?

Why do we need to use the builder design pattern when we can do the same thing with setters?

Do any jurisdictions seriously consider reclassifying social media websites as publishers?

What would you call this weird metallic apparatus that allows you to lift people?

Is it possible for SQL statements to execute concurrently within a single session in SQL Server?

How fail-safe is nr as stop bytes?

Why is my ESD wriststrap failing with nitrile gloves on?

What was the first language to use conditional keywords?

How do I find out the mythology and history of my Fortress?

How would a mousetrap for use in space work?

Localisation of Category



Configuring TCP services with nginx ingress on minikube/k8s



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
Come Celebrate our 10 Year Anniversary!How can I see which flags Nginx was compiled with?How to access apps that have been deployed in k8s on Google Cloud Platform using a Google Cloud Engine HTTP(S) Load Balancer?Ingress returns 'default backend - 404' on MinikubeUsing kubernetes ingress to expose multiple services, without exposing the services with NodePortNGINX Proxy to a K8S ELBGCE NGINX Ingress does not use controllerKubernetes: 502 Bad Gateway for some assets - with Nginx IngressKubernetes nginx ingress session affinitySetting up HTTP Load Balancing with Nginx Ingress Controllerminikube/k8s/kubectl “failed to watch file [ … ]: no space left on device”





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I'm new to k8s/minikube (and to some extent, unix networking in general) so if I ask something that seems to make no sense, I'll be happy to clarify!



Goal



I want to configure a port-based TCP ingress, as described briefly in the nginx-ingress docs. In particular, I want to use the webpack-dev-server from inside minikube.



Error



When it's set up according to my best understanding, I still get Failed to load resource: net::ERR_CONNECTION_REFUSED when requesting local.web:3001/client.js. That is, navigating in my browser to 'local.web/' brings up the page, but without the bundle that webpack is meant to be producing. The request for that fails.



Configuration



Moving from host machine to minikube pod, I have



/etc/hosts:



On my dev machine, I set local.web to the minikube IP



$ echo "$(minikube ip) local.web" | sudo tee -a /etc/hosts



Ingress:



{
"kind": "Ingress",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "dev-web-ingress",
"namespace": "dev",
"selfLink": "/apis/extensions/v1beta1/namespaces/dev/ingresses/dev-web-ingress",
"uid": "64ebfc93-612e-11e9-8df7-0800270e7244",
"resourceVersion": "280750",
"generation": 3,
"creationTimestamp": "2019-04-17T16:32:30Z",
"labels": {
"platform": "advocate",
"tier": "frontend"
},
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{"apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":{"annotations":{"kubernetes.io/ingress.class":"nginx"},"labels":{"platform":"advocate","tier":"frontend"},"name":"dev-web-ingress","namespace":"dev"},"spec":{"rules":[{"host":"local.web","http":{"paths":[{"backend":{"serviceName":"dev-adv-web-service","servicePort":"http"},"path":"/"}]}}]}}n",
"kubernetes.io/ingress.class": "nginx"
}
},
"spec": {
"rules": [
{
"host": "local.web",
"http": {
"paths": [
{
"path": "/",
"backend": {
"serviceName": "dev-adv-web-service",
"servicePort": "http"
}
}
]
}
}
]
},
"status": {
"loadBalancer": {
"ingress": [
{
"ip": "10.0.2.15"
}
]
}
}
}


TCP Services



{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "tcp-services",
"namespace": "dev",
"selfLink": "/api/v1/namespaces/dev/configmaps/tcp-services",
"uid": "5e456f3e-622e-11e9-bcf8-0800270e7244",
"resourceVersion": "295220",
"creationTimestamp": "2019-04-18T23:04:50Z",
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{"apiVersion":"v1","data":{"3001":"dev/dev-adv-web-service:3001","9290":"dev/dev-echoserver:8080"},"kind":"ConfigMap","metadata":{"annotations":{},"name":"tcp-services","namespace":"dev"}}n"
}
},
"data": {
"3001": "dev/dev-adv-web-service:3001",
}
}


Service:



{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "dev-adv-web-service",
"namespace": "dev",
"selfLink": "/api/v1/namespaces/dev/services/dev-adv-web-service",
"uid": "64e3c65d-612e-11e9-8df7-0800270e7244",
"resourceVersion": "280675",
"creationTimestamp": "2019-04-17T16:32:30Z",
"labels": {
"app": "adv-web",
"tier": "frontend"
},
"annotations": [... edited for clarity]
},
"spec": {
"ports": [
{
"name": "http",
"protocol": "TCP",
"port": 80,
"targetPort": 3000,
"nodePort": 31246
},
{
"name": "http2",
"protocol": "TCP",
"port": 3001,
"targetPort": 3001,
"nodePort": 31392
}
],
"selector": {
"app": "frontend-container",
"tier": "frontend"
},
"clusterIP": "10.108.24.80",
"type": "LoadBalancer",
"sessionAffinity": "None",
"externalTrafficPolicy": "Cluster"
},
"status": {
"loadBalancer": {}
}
}


Pod



{
"kind": "Pod",
"apiVersion": "v1",
"metadata": {
"name": "dev-adv-web-768767454f-wxvnh",
"generateName": "dev-adv-web-768767454f-",
"namespace": "dev",
"selfLink": "/api/v1/namespaces/dev/pods/dev-adv-web-768767454f-wxvnh",
"uid": "65de844e-622c-11e9-bcf8-0800270e7244",
"resourceVersion": "294073",
"creationTimestamp": "2019-04-18T22:50:43Z",
"labels": {
"app": "frontend-container",
"pod-template-hash": "768767454f",
"tier": "frontend"
},
"ownerReferences": [
{
"apiVersion": "apps/v1",
"kind": "ReplicaSet",
"name": "dev-adv-web-768767454f",
"uid": "4babd3e7-613d-11e9-8df7-0800270e7244",
"controller": true,
"blockOwnerDeletion": true
}
]
},
"spec": {
"volumes": [
{
"name": "frontend-repo",
"hostPath": {
"path": "/Users/me/Projects/code/frontend",
"type": ""
}
},
{
"name": "default-token-7rfht",
"secret": {
"secretName": "default-token-7rfht",
"defaultMode": 420
}
}
],
"containers": [
{
"name": "adv-web-container",
"image": "localhost:5000/react:dev",
"command": [
"npm",
"run",
"dev"
],
"ports": [
{
"name": "http",
"containerPort": 3000,
"protocol": "TCP"
},
{
"name": "http2",
"containerPort": 3001,
"protocol": "TCP"
}
],
"env": [
{
"name": "HOSTNAME_PUBLISHED",
"valueFrom": {
"configMapKeyRef": {
"name": "dev-frontend-configmap",
"key": "HOSTNAME_PUBLISHED"
}
}
},
{
"name": "LOCAL_DOMAIN",
"valueFrom": {
"configMapKeyRef": {
"name": "dev-frontend-configmap",
"key": "LOCAL_DOMAIN"
}
}
},
{
"name": "HOST",
"valueFrom": {
"configMapKeyRef": {
"name": "dev-frontend-configmap",
"key": "HOST"
}
}
},
{
"name": "WEBPACK_PUBLISHED_PORT",
"valueFrom": {
"configMapKeyRef": {
"name": "dev-frontend-configmap",
"key": "WEBPACK_PUBLISHED_PORT"
}
}
},
{
"name": "WEBPACK_LISTEN_PORT",
"valueFrom": {
"configMapKeyRef": {
"name": "dev-frontend-configmap",
"key": "WEBPACK_LISTEN_PORT"
}
}
},
{
"name": "API_URL",
"valueFrom": {
"configMapKeyRef": {
"name": "dev-frontend-configmap",
"key": "API_URL"
}
}
},
{
"name": "LOGIN_CALLBACK_URL",
"valueFrom": {
"configMapKeyRef": {
"name": "dev-frontend-configmap",
"key": "LOGIN_CALLBACK_URL"
}
}
},
{
"name": "NPM_CONFIG_LOGLEVEL",
"valueFrom": {
"configMapKeyRef": {
"name": "dev-frontend-configmap",
"key": "NPM_CONFIG_LOGLEVEL"
}
}
}
],
"resources": {},
"volumeMounts": [
{
"name": "frontend-repo",
"mountPath": "/code"
},
{
"name": "default-token-7rfht",
"readOnly": true,
"mountPath": "/var/run/secrets/kubernetes.io/serviceaccount"
}
],
"terminationMessagePath": "/dev/termination-log",
"terminationMessagePolicy": "File",
"imagePullPolicy": "Always"
}
],
"restartPolicy": "Always",
"terminationGracePeriodSeconds": 30,
"dnsPolicy": "ClusterFirst",
"serviceAccountName": "default",
"serviceAccount": "default",
"nodeName": "minikube",
"securityContext": {},
"schedulerName": "default-scheduler",
"tolerations": [
{
"key": "node.kubernetes.io/not-ready",
"operator": "Exists",
"effect": "NoExecute",
"tolerationSeconds": 300
},
{
"key": "node.kubernetes.io/unreachable",
"operator": "Exists",
"effect": "NoExecute",
"tolerationSeconds": 300
}
],
"priority": 0,
"enableServiceLinks": true
},
"status": {
"phase": "Running",
"conditions": [
{
"type": "Initialized",
"status": "True",
"lastProbeTime": null,
"lastTransitionTime": "2019-04-18T22:50:43Z"
},
{
"type": "Ready",
"status": "True",
"lastProbeTime": null,
"lastTransitionTime": "2019-04-18T22:50:45Z"
},
{
"type": "ContainersReady",
"status": "True",
"lastProbeTime": null,
"lastTransitionTime": "2019-04-18T22:50:45Z"
},
{
"type": "PodScheduled",
"status": "True",
"lastProbeTime": null,
"lastTransitionTime": "2019-04-18T22:50:43Z"
}
],
"hostIP": "10.0.2.15",
"podIP": "172.17.0.13",
"startTime": "2019-04-18T22:50:43Z",
"containerStatuses": [
{
"name": "adv-web-container",
"state": {
"running": {
"startedAt": "2019-04-18T22:50:44Z"
}
},
"lastState": {},
"ready": true,
"restartCount": 0,
"image": "localhost:5000/react:dev",
"imageID": "docker-pullable://localhost:5000/react@sha256:2bfe61ed134044bff4b23f5c057af2f9c480c3c1a1927a485f09f3410528903d",
"containerID": "docker://57b9b6dafaf2aba8a21d5dd7db3543f4742c00331b49b48dc1561e3b5bd05315"
}
],
"qosClass": "BestEffort"
}
}


Hypotheses



One thought was that the namespace on the TCP services ConfigMap was wrong. It's not clear to me from the docs where that's supposed to live. I have tried it in the namespace dev, where the ingress, service, and deployment/pods live. I also tried adding the data entry as above to the tcp-services ConfigMap in kube-system.



The logs for the webpack pod show no errors, so I don't believe the problem is at the application level.



Since the GET local.web/ is returning data from the pod, I am convinced the service is at least partially correct.



I'm willing to perform any debugging you can suggest, and have no illusions that I know anything about what's going on--I'll be grateful for any help offered.









share





























    0















    I'm new to k8s/minikube (and to some extent, unix networking in general) so if I ask something that seems to make no sense, I'll be happy to clarify!



    Goal



    I want to configure a port-based TCP ingress, as described briefly in the nginx-ingress docs. In particular, I want to use the webpack-dev-server from inside minikube.



    Error



    When it's set up according to my best understanding, I still get Failed to load resource: net::ERR_CONNECTION_REFUSED when requesting local.web:3001/client.js. That is, navigating in my browser to 'local.web/' brings up the page, but without the bundle that webpack is meant to be producing. The request for that fails.



    Configuration



    Moving from host machine to minikube pod, I have



    /etc/hosts:



    On my dev machine, I set local.web to the minikube IP



    $ echo "$(minikube ip) local.web" | sudo tee -a /etc/hosts



    Ingress:



    {
    "kind": "Ingress",
    "apiVersion": "extensions/v1beta1",
    "metadata": {
    "name": "dev-web-ingress",
    "namespace": "dev",
    "selfLink": "/apis/extensions/v1beta1/namespaces/dev/ingresses/dev-web-ingress",
    "uid": "64ebfc93-612e-11e9-8df7-0800270e7244",
    "resourceVersion": "280750",
    "generation": 3,
    "creationTimestamp": "2019-04-17T16:32:30Z",
    "labels": {
    "platform": "advocate",
    "tier": "frontend"
    },
    "annotations": {
    "kubectl.kubernetes.io/last-applied-configuration": "{"apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":{"annotations":{"kubernetes.io/ingress.class":"nginx"},"labels":{"platform":"advocate","tier":"frontend"},"name":"dev-web-ingress","namespace":"dev"},"spec":{"rules":[{"host":"local.web","http":{"paths":[{"backend":{"serviceName":"dev-adv-web-service","servicePort":"http"},"path":"/"}]}}]}}n",
    "kubernetes.io/ingress.class": "nginx"
    }
    },
    "spec": {
    "rules": [
    {
    "host": "local.web",
    "http": {
    "paths": [
    {
    "path": "/",
    "backend": {
    "serviceName": "dev-adv-web-service",
    "servicePort": "http"
    }
    }
    ]
    }
    }
    ]
    },
    "status": {
    "loadBalancer": {
    "ingress": [
    {
    "ip": "10.0.2.15"
    }
    ]
    }
    }
    }


    TCP Services



    {
    "kind": "ConfigMap",
    "apiVersion": "v1",
    "metadata": {
    "name": "tcp-services",
    "namespace": "dev",
    "selfLink": "/api/v1/namespaces/dev/configmaps/tcp-services",
    "uid": "5e456f3e-622e-11e9-bcf8-0800270e7244",
    "resourceVersion": "295220",
    "creationTimestamp": "2019-04-18T23:04:50Z",
    "annotations": {
    "kubectl.kubernetes.io/last-applied-configuration": "{"apiVersion":"v1","data":{"3001":"dev/dev-adv-web-service:3001","9290":"dev/dev-echoserver:8080"},"kind":"ConfigMap","metadata":{"annotations":{},"name":"tcp-services","namespace":"dev"}}n"
    }
    },
    "data": {
    "3001": "dev/dev-adv-web-service:3001",
    }
    }


    Service:



    {
    "kind": "Service",
    "apiVersion": "v1",
    "metadata": {
    "name": "dev-adv-web-service",
    "namespace": "dev",
    "selfLink": "/api/v1/namespaces/dev/services/dev-adv-web-service",
    "uid": "64e3c65d-612e-11e9-8df7-0800270e7244",
    "resourceVersion": "280675",
    "creationTimestamp": "2019-04-17T16:32:30Z",
    "labels": {
    "app": "adv-web",
    "tier": "frontend"
    },
    "annotations": [... edited for clarity]
    },
    "spec": {
    "ports": [
    {
    "name": "http",
    "protocol": "TCP",
    "port": 80,
    "targetPort": 3000,
    "nodePort": 31246
    },
    {
    "name": "http2",
    "protocol": "TCP",
    "port": 3001,
    "targetPort": 3001,
    "nodePort": 31392
    }
    ],
    "selector": {
    "app": "frontend-container",
    "tier": "frontend"
    },
    "clusterIP": "10.108.24.80",
    "type": "LoadBalancer",
    "sessionAffinity": "None",
    "externalTrafficPolicy": "Cluster"
    },
    "status": {
    "loadBalancer": {}
    }
    }


    Pod



    {
    "kind": "Pod",
    "apiVersion": "v1",
    "metadata": {
    "name": "dev-adv-web-768767454f-wxvnh",
    "generateName": "dev-adv-web-768767454f-",
    "namespace": "dev",
    "selfLink": "/api/v1/namespaces/dev/pods/dev-adv-web-768767454f-wxvnh",
    "uid": "65de844e-622c-11e9-bcf8-0800270e7244",
    "resourceVersion": "294073",
    "creationTimestamp": "2019-04-18T22:50:43Z",
    "labels": {
    "app": "frontend-container",
    "pod-template-hash": "768767454f",
    "tier": "frontend"
    },
    "ownerReferences": [
    {
    "apiVersion": "apps/v1",
    "kind": "ReplicaSet",
    "name": "dev-adv-web-768767454f",
    "uid": "4babd3e7-613d-11e9-8df7-0800270e7244",
    "controller": true,
    "blockOwnerDeletion": true
    }
    ]
    },
    "spec": {
    "volumes": [
    {
    "name": "frontend-repo",
    "hostPath": {
    "path": "/Users/me/Projects/code/frontend",
    "type": ""
    }
    },
    {
    "name": "default-token-7rfht",
    "secret": {
    "secretName": "default-token-7rfht",
    "defaultMode": 420
    }
    }
    ],
    "containers": [
    {
    "name": "adv-web-container",
    "image": "localhost:5000/react:dev",
    "command": [
    "npm",
    "run",
    "dev"
    ],
    "ports": [
    {
    "name": "http",
    "containerPort": 3000,
    "protocol": "TCP"
    },
    {
    "name": "http2",
    "containerPort": 3001,
    "protocol": "TCP"
    }
    ],
    "env": [
    {
    "name": "HOSTNAME_PUBLISHED",
    "valueFrom": {
    "configMapKeyRef": {
    "name": "dev-frontend-configmap",
    "key": "HOSTNAME_PUBLISHED"
    }
    }
    },
    {
    "name": "LOCAL_DOMAIN",
    "valueFrom": {
    "configMapKeyRef": {
    "name": "dev-frontend-configmap",
    "key": "LOCAL_DOMAIN"
    }
    }
    },
    {
    "name": "HOST",
    "valueFrom": {
    "configMapKeyRef": {
    "name": "dev-frontend-configmap",
    "key": "HOST"
    }
    }
    },
    {
    "name": "WEBPACK_PUBLISHED_PORT",
    "valueFrom": {
    "configMapKeyRef": {
    "name": "dev-frontend-configmap",
    "key": "WEBPACK_PUBLISHED_PORT"
    }
    }
    },
    {
    "name": "WEBPACK_LISTEN_PORT",
    "valueFrom": {
    "configMapKeyRef": {
    "name": "dev-frontend-configmap",
    "key": "WEBPACK_LISTEN_PORT"
    }
    }
    },
    {
    "name": "API_URL",
    "valueFrom": {
    "configMapKeyRef": {
    "name": "dev-frontend-configmap",
    "key": "API_URL"
    }
    }
    },
    {
    "name": "LOGIN_CALLBACK_URL",
    "valueFrom": {
    "configMapKeyRef": {
    "name": "dev-frontend-configmap",
    "key": "LOGIN_CALLBACK_URL"
    }
    }
    },
    {
    "name": "NPM_CONFIG_LOGLEVEL",
    "valueFrom": {
    "configMapKeyRef": {
    "name": "dev-frontend-configmap",
    "key": "NPM_CONFIG_LOGLEVEL"
    }
    }
    }
    ],
    "resources": {},
    "volumeMounts": [
    {
    "name": "frontend-repo",
    "mountPath": "/code"
    },
    {
    "name": "default-token-7rfht",
    "readOnly": true,
    "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount"
    }
    ],
    "terminationMessagePath": "/dev/termination-log",
    "terminationMessagePolicy": "File",
    "imagePullPolicy": "Always"
    }
    ],
    "restartPolicy": "Always",
    "terminationGracePeriodSeconds": 30,
    "dnsPolicy": "ClusterFirst",
    "serviceAccountName": "default",
    "serviceAccount": "default",
    "nodeName": "minikube",
    "securityContext": {},
    "schedulerName": "default-scheduler",
    "tolerations": [
    {
    "key": "node.kubernetes.io/not-ready",
    "operator": "Exists",
    "effect": "NoExecute",
    "tolerationSeconds": 300
    },
    {
    "key": "node.kubernetes.io/unreachable",
    "operator": "Exists",
    "effect": "NoExecute",
    "tolerationSeconds": 300
    }
    ],
    "priority": 0,
    "enableServiceLinks": true
    },
    "status": {
    "phase": "Running",
    "conditions": [
    {
    "type": "Initialized",
    "status": "True",
    "lastProbeTime": null,
    "lastTransitionTime": "2019-04-18T22:50:43Z"
    },
    {
    "type": "Ready",
    "status": "True",
    "lastProbeTime": null,
    "lastTransitionTime": "2019-04-18T22:50:45Z"
    },
    {
    "type": "ContainersReady",
    "status": "True",
    "lastProbeTime": null,
    "lastTransitionTime": "2019-04-18T22:50:45Z"
    },
    {
    "type": "PodScheduled",
    "status": "True",
    "lastProbeTime": null,
    "lastTransitionTime": "2019-04-18T22:50:43Z"
    }
    ],
    "hostIP": "10.0.2.15",
    "podIP": "172.17.0.13",
    "startTime": "2019-04-18T22:50:43Z",
    "containerStatuses": [
    {
    "name": "adv-web-container",
    "state": {
    "running": {
    "startedAt": "2019-04-18T22:50:44Z"
    }
    },
    "lastState": {},
    "ready": true,
    "restartCount": 0,
    "image": "localhost:5000/react:dev",
    "imageID": "docker-pullable://localhost:5000/react@sha256:2bfe61ed134044bff4b23f5c057af2f9c480c3c1a1927a485f09f3410528903d",
    "containerID": "docker://57b9b6dafaf2aba8a21d5dd7db3543f4742c00331b49b48dc1561e3b5bd05315"
    }
    ],
    "qosClass": "BestEffort"
    }
    }


    Hypotheses



    One thought was that the namespace on the TCP services ConfigMap was wrong. It's not clear to me from the docs where that's supposed to live. I have tried it in the namespace dev, where the ingress, service, and deployment/pods live. I also tried adding the data entry as above to the tcp-services ConfigMap in kube-system.



    The logs for the webpack pod show no errors, so I don't believe the problem is at the application level.



    Since the GET local.web/ is returning data from the pod, I am convinced the service is at least partially correct.



    I'm willing to perform any debugging you can suggest, and have no illusions that I know anything about what's going on--I'll be grateful for any help offered.









    share

























      0












      0








      0








      I'm new to k8s/minikube (and to some extent, unix networking in general) so if I ask something that seems to make no sense, I'll be happy to clarify!



      Goal



      I want to configure a port-based TCP ingress, as described briefly in the nginx-ingress docs. In particular, I want to use the webpack-dev-server from inside minikube.



      Error



      When it's set up according to my best understanding, I still get Failed to load resource: net::ERR_CONNECTION_REFUSED when requesting local.web:3001/client.js. That is, navigating in my browser to 'local.web/' brings up the page, but without the bundle that webpack is meant to be producing. The request for that fails.



      Configuration



      Moving from host machine to minikube pod, I have



      /etc/hosts:



      On my dev machine, I set local.web to the minikube IP



      $ echo "$(minikube ip) local.web" | sudo tee -a /etc/hosts



      Ingress:



      {
      "kind": "Ingress",
      "apiVersion": "extensions/v1beta1",
      "metadata": {
      "name": "dev-web-ingress",
      "namespace": "dev",
      "selfLink": "/apis/extensions/v1beta1/namespaces/dev/ingresses/dev-web-ingress",
      "uid": "64ebfc93-612e-11e9-8df7-0800270e7244",
      "resourceVersion": "280750",
      "generation": 3,
      "creationTimestamp": "2019-04-17T16:32:30Z",
      "labels": {
      "platform": "advocate",
      "tier": "frontend"
      },
      "annotations": {
      "kubectl.kubernetes.io/last-applied-configuration": "{"apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":{"annotations":{"kubernetes.io/ingress.class":"nginx"},"labels":{"platform":"advocate","tier":"frontend"},"name":"dev-web-ingress","namespace":"dev"},"spec":{"rules":[{"host":"local.web","http":{"paths":[{"backend":{"serviceName":"dev-adv-web-service","servicePort":"http"},"path":"/"}]}}]}}n",
      "kubernetes.io/ingress.class": "nginx"
      }
      },
      "spec": {
      "rules": [
      {
      "host": "local.web",
      "http": {
      "paths": [
      {
      "path": "/",
      "backend": {
      "serviceName": "dev-adv-web-service",
      "servicePort": "http"
      }
      }
      ]
      }
      }
      ]
      },
      "status": {
      "loadBalancer": {
      "ingress": [
      {
      "ip": "10.0.2.15"
      }
      ]
      }
      }
      }


      TCP Services



      {
      "kind": "ConfigMap",
      "apiVersion": "v1",
      "metadata": {
      "name": "tcp-services",
      "namespace": "dev",
      "selfLink": "/api/v1/namespaces/dev/configmaps/tcp-services",
      "uid": "5e456f3e-622e-11e9-bcf8-0800270e7244",
      "resourceVersion": "295220",
      "creationTimestamp": "2019-04-18T23:04:50Z",
      "annotations": {
      "kubectl.kubernetes.io/last-applied-configuration": "{"apiVersion":"v1","data":{"3001":"dev/dev-adv-web-service:3001","9290":"dev/dev-echoserver:8080"},"kind":"ConfigMap","metadata":{"annotations":{},"name":"tcp-services","namespace":"dev"}}n"
      }
      },
      "data": {
      "3001": "dev/dev-adv-web-service:3001",
      }
      }


      Service:



      {
      "kind": "Service",
      "apiVersion": "v1",
      "metadata": {
      "name": "dev-adv-web-service",
      "namespace": "dev",
      "selfLink": "/api/v1/namespaces/dev/services/dev-adv-web-service",
      "uid": "64e3c65d-612e-11e9-8df7-0800270e7244",
      "resourceVersion": "280675",
      "creationTimestamp": "2019-04-17T16:32:30Z",
      "labels": {
      "app": "adv-web",
      "tier": "frontend"
      },
      "annotations": [... edited for clarity]
      },
      "spec": {
      "ports": [
      {
      "name": "http",
      "protocol": "TCP",
      "port": 80,
      "targetPort": 3000,
      "nodePort": 31246
      },
      {
      "name": "http2",
      "protocol": "TCP",
      "port": 3001,
      "targetPort": 3001,
      "nodePort": 31392
      }
      ],
      "selector": {
      "app": "frontend-container",
      "tier": "frontend"
      },
      "clusterIP": "10.108.24.80",
      "type": "LoadBalancer",
      "sessionAffinity": "None",
      "externalTrafficPolicy": "Cluster"
      },
      "status": {
      "loadBalancer": {}
      }
      }


      Pod



      {
      "kind": "Pod",
      "apiVersion": "v1",
      "metadata": {
      "name": "dev-adv-web-768767454f-wxvnh",
      "generateName": "dev-adv-web-768767454f-",
      "namespace": "dev",
      "selfLink": "/api/v1/namespaces/dev/pods/dev-adv-web-768767454f-wxvnh",
      "uid": "65de844e-622c-11e9-bcf8-0800270e7244",
      "resourceVersion": "294073",
      "creationTimestamp": "2019-04-18T22:50:43Z",
      "labels": {
      "app": "frontend-container",
      "pod-template-hash": "768767454f",
      "tier": "frontend"
      },
      "ownerReferences": [
      {
      "apiVersion": "apps/v1",
      "kind": "ReplicaSet",
      "name": "dev-adv-web-768767454f",
      "uid": "4babd3e7-613d-11e9-8df7-0800270e7244",
      "controller": true,
      "blockOwnerDeletion": true
      }
      ]
      },
      "spec": {
      "volumes": [
      {
      "name": "frontend-repo",
      "hostPath": {
      "path": "/Users/me/Projects/code/frontend",
      "type": ""
      }
      },
      {
      "name": "default-token-7rfht",
      "secret": {
      "secretName": "default-token-7rfht",
      "defaultMode": 420
      }
      }
      ],
      "containers": [
      {
      "name": "adv-web-container",
      "image": "localhost:5000/react:dev",
      "command": [
      "npm",
      "run",
      "dev"
      ],
      "ports": [
      {
      "name": "http",
      "containerPort": 3000,
      "protocol": "TCP"
      },
      {
      "name": "http2",
      "containerPort": 3001,
      "protocol": "TCP"
      }
      ],
      "env": [
      {
      "name": "HOSTNAME_PUBLISHED",
      "valueFrom": {
      "configMapKeyRef": {
      "name": "dev-frontend-configmap",
      "key": "HOSTNAME_PUBLISHED"
      }
      }
      },
      {
      "name": "LOCAL_DOMAIN",
      "valueFrom": {
      "configMapKeyRef": {
      "name": "dev-frontend-configmap",
      "key": "LOCAL_DOMAIN"
      }
      }
      },
      {
      "name": "HOST",
      "valueFrom": {
      "configMapKeyRef": {
      "name": "dev-frontend-configmap",
      "key": "HOST"
      }
      }
      },
      {
      "name": "WEBPACK_PUBLISHED_PORT",
      "valueFrom": {
      "configMapKeyRef": {
      "name": "dev-frontend-configmap",
      "key": "WEBPACK_PUBLISHED_PORT"
      }
      }
      },
      {
      "name": "WEBPACK_LISTEN_PORT",
      "valueFrom": {
      "configMapKeyRef": {
      "name": "dev-frontend-configmap",
      "key": "WEBPACK_LISTEN_PORT"
      }
      }
      },
      {
      "name": "API_URL",
      "valueFrom": {
      "configMapKeyRef": {
      "name": "dev-frontend-configmap",
      "key": "API_URL"
      }
      }
      },
      {
      "name": "LOGIN_CALLBACK_URL",
      "valueFrom": {
      "configMapKeyRef": {
      "name": "dev-frontend-configmap",
      "key": "LOGIN_CALLBACK_URL"
      }
      }
      },
      {
      "name": "NPM_CONFIG_LOGLEVEL",
      "valueFrom": {
      "configMapKeyRef": {
      "name": "dev-frontend-configmap",
      "key": "NPM_CONFIG_LOGLEVEL"
      }
      }
      }
      ],
      "resources": {},
      "volumeMounts": [
      {
      "name": "frontend-repo",
      "mountPath": "/code"
      },
      {
      "name": "default-token-7rfht",
      "readOnly": true,
      "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount"
      }
      ],
      "terminationMessagePath": "/dev/termination-log",
      "terminationMessagePolicy": "File",
      "imagePullPolicy": "Always"
      }
      ],
      "restartPolicy": "Always",
      "terminationGracePeriodSeconds": 30,
      "dnsPolicy": "ClusterFirst",
      "serviceAccountName": "default",
      "serviceAccount": "default",
      "nodeName": "minikube",
      "securityContext": {},
      "schedulerName": "default-scheduler",
      "tolerations": [
      {
      "key": "node.kubernetes.io/not-ready",
      "operator": "Exists",
      "effect": "NoExecute",
      "tolerationSeconds": 300
      },
      {
      "key": "node.kubernetes.io/unreachable",
      "operator": "Exists",
      "effect": "NoExecute",
      "tolerationSeconds": 300
      }
      ],
      "priority": 0,
      "enableServiceLinks": true
      },
      "status": {
      "phase": "Running",
      "conditions": [
      {
      "type": "Initialized",
      "status": "True",
      "lastProbeTime": null,
      "lastTransitionTime": "2019-04-18T22:50:43Z"
      },
      {
      "type": "Ready",
      "status": "True",
      "lastProbeTime": null,
      "lastTransitionTime": "2019-04-18T22:50:45Z"
      },
      {
      "type": "ContainersReady",
      "status": "True",
      "lastProbeTime": null,
      "lastTransitionTime": "2019-04-18T22:50:45Z"
      },
      {
      "type": "PodScheduled",
      "status": "True",
      "lastProbeTime": null,
      "lastTransitionTime": "2019-04-18T22:50:43Z"
      }
      ],
      "hostIP": "10.0.2.15",
      "podIP": "172.17.0.13",
      "startTime": "2019-04-18T22:50:43Z",
      "containerStatuses": [
      {
      "name": "adv-web-container",
      "state": {
      "running": {
      "startedAt": "2019-04-18T22:50:44Z"
      }
      },
      "lastState": {},
      "ready": true,
      "restartCount": 0,
      "image": "localhost:5000/react:dev",
      "imageID": "docker-pullable://localhost:5000/react@sha256:2bfe61ed134044bff4b23f5c057af2f9c480c3c1a1927a485f09f3410528903d",
      "containerID": "docker://57b9b6dafaf2aba8a21d5dd7db3543f4742c00331b49b48dc1561e3b5bd05315"
      }
      ],
      "qosClass": "BestEffort"
      }
      }


      Hypotheses



      One thought was that the namespace on the TCP services ConfigMap was wrong. It's not clear to me from the docs where that's supposed to live. I have tried it in the namespace dev, where the ingress, service, and deployment/pods live. I also tried adding the data entry as above to the tcp-services ConfigMap in kube-system.



      The logs for the webpack pod show no errors, so I don't believe the problem is at the application level.



      Since the GET local.web/ is returning data from the pod, I am convinced the service is at least partially correct.



      I'm willing to perform any debugging you can suggest, and have no illusions that I know anything about what's going on--I'll be grateful for any help offered.









      share














      I'm new to k8s/minikube (and to some extent, unix networking in general) so if I ask something that seems to make no sense, I'll be happy to clarify!



      Goal



      I want to configure a port-based TCP ingress, as described briefly in the nginx-ingress docs. In particular, I want to use the webpack-dev-server from inside minikube.



      Error



      When it's set up according to my best understanding, I still get Failed to load resource: net::ERR_CONNECTION_REFUSED when requesting local.web:3001/client.js. That is, navigating in my browser to 'local.web/' brings up the page, but without the bundle that webpack is meant to be producing. The request for that fails.



      Configuration



      Moving from host machine to minikube pod, I have



      /etc/hosts:



      On my dev machine, I set local.web to the minikube IP



      $ echo "$(minikube ip) local.web" | sudo tee -a /etc/hosts



      Ingress:



      {
      "kind": "Ingress",
      "apiVersion": "extensions/v1beta1",
      "metadata": {
      "name": "dev-web-ingress",
      "namespace": "dev",
      "selfLink": "/apis/extensions/v1beta1/namespaces/dev/ingresses/dev-web-ingress",
      "uid": "64ebfc93-612e-11e9-8df7-0800270e7244",
      "resourceVersion": "280750",
      "generation": 3,
      "creationTimestamp": "2019-04-17T16:32:30Z",
      "labels": {
      "platform": "advocate",
      "tier": "frontend"
      },
      "annotations": {
      "kubectl.kubernetes.io/last-applied-configuration": "{"apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":{"annotations":{"kubernetes.io/ingress.class":"nginx"},"labels":{"platform":"advocate","tier":"frontend"},"name":"dev-web-ingress","namespace":"dev"},"spec":{"rules":[{"host":"local.web","http":{"paths":[{"backend":{"serviceName":"dev-adv-web-service","servicePort":"http"},"path":"/"}]}}]}}n",
      "kubernetes.io/ingress.class": "nginx"
      }
      },
      "spec": {
      "rules": [
      {
      "host": "local.web",
      "http": {
      "paths": [
      {
      "path": "/",
      "backend": {
      "serviceName": "dev-adv-web-service",
      "servicePort": "http"
      }
      }
      ]
      }
      }
      ]
      },
      "status": {
      "loadBalancer": {
      "ingress": [
      {
      "ip": "10.0.2.15"
      }
      ]
      }
      }
      }


      TCP Services



      {
      "kind": "ConfigMap",
      "apiVersion": "v1",
      "metadata": {
      "name": "tcp-services",
      "namespace": "dev",
      "selfLink": "/api/v1/namespaces/dev/configmaps/tcp-services",
      "uid": "5e456f3e-622e-11e9-bcf8-0800270e7244",
      "resourceVersion": "295220",
      "creationTimestamp": "2019-04-18T23:04:50Z",
      "annotations": {
      "kubectl.kubernetes.io/last-applied-configuration": "{"apiVersion":"v1","data":{"3001":"dev/dev-adv-web-service:3001","9290":"dev/dev-echoserver:8080"},"kind":"ConfigMap","metadata":{"annotations":{},"name":"tcp-services","namespace":"dev"}}n"
      }
      },
      "data": {
      "3001": "dev/dev-adv-web-service:3001",
      }
      }


      Service:



      {
      "kind": "Service",
      "apiVersion": "v1",
      "metadata": {
      "name": "dev-adv-web-service",
      "namespace": "dev",
      "selfLink": "/api/v1/namespaces/dev/services/dev-adv-web-service",
      "uid": "64e3c65d-612e-11e9-8df7-0800270e7244",
      "resourceVersion": "280675",
      "creationTimestamp": "2019-04-17T16:32:30Z",
      "labels": {
      "app": "adv-web",
      "tier": "frontend"
      },
      "annotations": [... edited for clarity]
      },
      "spec": {
      "ports": [
      {
      "name": "http",
      "protocol": "TCP",
      "port": 80,
      "targetPort": 3000,
      "nodePort": 31246
      },
      {
      "name": "http2",
      "protocol": "TCP",
      "port": 3001,
      "targetPort": 3001,
      "nodePort": 31392
      }
      ],
      "selector": {
      "app": "frontend-container",
      "tier": "frontend"
      },
      "clusterIP": "10.108.24.80",
      "type": "LoadBalancer",
      "sessionAffinity": "None",
      "externalTrafficPolicy": "Cluster"
      },
      "status": {
      "loadBalancer": {}
      }
      }


      Pod



      {
      "kind": "Pod",
      "apiVersion": "v1",
      "metadata": {
      "name": "dev-adv-web-768767454f-wxvnh",
      "generateName": "dev-adv-web-768767454f-",
      "namespace": "dev",
      "selfLink": "/api/v1/namespaces/dev/pods/dev-adv-web-768767454f-wxvnh",
      "uid": "65de844e-622c-11e9-bcf8-0800270e7244",
      "resourceVersion": "294073",
      "creationTimestamp": "2019-04-18T22:50:43Z",
      "labels": {
      "app": "frontend-container",
      "pod-template-hash": "768767454f",
      "tier": "frontend"
      },
      "ownerReferences": [
      {
      "apiVersion": "apps/v1",
      "kind": "ReplicaSet",
      "name": "dev-adv-web-768767454f",
      "uid": "4babd3e7-613d-11e9-8df7-0800270e7244",
      "controller": true,
      "blockOwnerDeletion": true
      }
      ]
      },
      "spec": {
      "volumes": [
      {
      "name": "frontend-repo",
      "hostPath": {
      "path": "/Users/me/Projects/code/frontend",
      "type": ""
      }
      },
      {
      "name": "default-token-7rfht",
      "secret": {
      "secretName": "default-token-7rfht",
      "defaultMode": 420
      }
      }
      ],
      "containers": [
      {
      "name": "adv-web-container",
      "image": "localhost:5000/react:dev",
      "command": [
      "npm",
      "run",
      "dev"
      ],
      "ports": [
      {
      "name": "http",
      "containerPort": 3000,
      "protocol": "TCP"
      },
      {
      "name": "http2",
      "containerPort": 3001,
      "protocol": "TCP"
      }
      ],
      "env": [
      {
      "name": "HOSTNAME_PUBLISHED",
      "valueFrom": {
      "configMapKeyRef": {
      "name": "dev-frontend-configmap",
      "key": "HOSTNAME_PUBLISHED"
      }
      }
      },
      {
      "name": "LOCAL_DOMAIN",
      "valueFrom": {
      "configMapKeyRef": {
      "name": "dev-frontend-configmap",
      "key": "LOCAL_DOMAIN"
      }
      }
      },
      {
      "name": "HOST",
      "valueFrom": {
      "configMapKeyRef": {
      "name": "dev-frontend-configmap",
      "key": "HOST"
      }
      }
      },
      {
      "name": "WEBPACK_PUBLISHED_PORT",
      "valueFrom": {
      "configMapKeyRef": {
      "name": "dev-frontend-configmap",
      "key": "WEBPACK_PUBLISHED_PORT"
      }
      }
      },
      {
      "name": "WEBPACK_LISTEN_PORT",
      "valueFrom": {
      "configMapKeyRef": {
      "name": "dev-frontend-configmap",
      "key": "WEBPACK_LISTEN_PORT"
      }
      }
      },
      {
      "name": "API_URL",
      "valueFrom": {
      "configMapKeyRef": {
      "name": "dev-frontend-configmap",
      "key": "API_URL"
      }
      }
      },
      {
      "name": "LOGIN_CALLBACK_URL",
      "valueFrom": {
      "configMapKeyRef": {
      "name": "dev-frontend-configmap",
      "key": "LOGIN_CALLBACK_URL"
      }
      }
      },
      {
      "name": "NPM_CONFIG_LOGLEVEL",
      "valueFrom": {
      "configMapKeyRef": {
      "name": "dev-frontend-configmap",
      "key": "NPM_CONFIG_LOGLEVEL"
      }
      }
      }
      ],
      "resources": {},
      "volumeMounts": [
      {
      "name": "frontend-repo",
      "mountPath": "/code"
      },
      {
      "name": "default-token-7rfht",
      "readOnly": true,
      "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount"
      }
      ],
      "terminationMessagePath": "/dev/termination-log",
      "terminationMessagePolicy": "File",
      "imagePullPolicy": "Always"
      }
      ],
      "restartPolicy": "Always",
      "terminationGracePeriodSeconds": 30,
      "dnsPolicy": "ClusterFirst",
      "serviceAccountName": "default",
      "serviceAccount": "default",
      "nodeName": "minikube",
      "securityContext": {},
      "schedulerName": "default-scheduler",
      "tolerations": [
      {
      "key": "node.kubernetes.io/not-ready",
      "operator": "Exists",
      "effect": "NoExecute",
      "tolerationSeconds": 300
      },
      {
      "key": "node.kubernetes.io/unreachable",
      "operator": "Exists",
      "effect": "NoExecute",
      "tolerationSeconds": 300
      }
      ],
      "priority": 0,
      "enableServiceLinks": true
      },
      "status": {
      "phase": "Running",
      "conditions": [
      {
      "type": "Initialized",
      "status": "True",
      "lastProbeTime": null,
      "lastTransitionTime": "2019-04-18T22:50:43Z"
      },
      {
      "type": "Ready",
      "status": "True",
      "lastProbeTime": null,
      "lastTransitionTime": "2019-04-18T22:50:45Z"
      },
      {
      "type": "ContainersReady",
      "status": "True",
      "lastProbeTime": null,
      "lastTransitionTime": "2019-04-18T22:50:45Z"
      },
      {
      "type": "PodScheduled",
      "status": "True",
      "lastProbeTime": null,
      "lastTransitionTime": "2019-04-18T22:50:43Z"
      }
      ],
      "hostIP": "10.0.2.15",
      "podIP": "172.17.0.13",
      "startTime": "2019-04-18T22:50:43Z",
      "containerStatuses": [
      {
      "name": "adv-web-container",
      "state": {
      "running": {
      "startedAt": "2019-04-18T22:50:44Z"
      }
      },
      "lastState": {},
      "ready": true,
      "restartCount": 0,
      "image": "localhost:5000/react:dev",
      "imageID": "docker-pullable://localhost:5000/react@sha256:2bfe61ed134044bff4b23f5c057af2f9c480c3c1a1927a485f09f3410528903d",
      "containerID": "docker://57b9b6dafaf2aba8a21d5dd7db3543f4742c00331b49b48dc1561e3b5bd05315"
      }
      ],
      "qosClass": "BestEffort"
      }
      }


      Hypotheses



      One thought was that the namespace on the TCP services ConfigMap was wrong. It's not clear to me from the docs where that's supposed to live. I have tried it in the namespace dev, where the ingress, service, and deployment/pods live. I also tried adding the data entry as above to the tcp-services ConfigMap in kube-system.



      The logs for the webpack pod show no errors, so I don't believe the problem is at the application level.



      Since the GET local.web/ is returning data from the pod, I am convinced the service is at least partially correct.



      I'm willing to perform any debugging you can suggest, and have no illusions that I know anything about what's going on--I'll be grateful for any help offered.







      networking nginx tcp kubernetes minikube





      share












      share










      share



      share










      asked 4 mins ago









      BenBen

      1116




      1116






















          0






          active

          oldest

          votes












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "2"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f963754%2fconfiguring-tcp-services-with-nginx-ingress-on-minikube-k8s%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Server Fault!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f963754%2fconfiguring-tcp-services-with-nginx-ingress-on-minikube-k8s%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          117736 Шеррод Примітки | Див. також | Посилання | Навігаційне...

          As a Security Precaution, the user account has been locked The Next CEO of Stack OverflowMS...

          Маріан Котлеба Зміст Життєпис | Політичні погляди |...