Access to exposed service in Kubernetes

5/8/2019

For the setup details:

  • Kubernetes Cluster (1 Master with ip .222 - 2 Nodes) in a VMWare environment
  • Installed Ingress Controller, sample app from NGINXINC REPO

Problem & Question:

  • Unable to access the application from outside the Kubernetes Cluster
  • What do i miss ?

Configuration:

kubectl get svc

output

 NAME         TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)   AGE
coffee-svc   ClusterIP   10.109.97.144   <none>        80/TCP    60m

A Curl from inside the Master ( with ip .222)

curl http://10.109.97.144/coffee

output

Server address: 10.36.0.5:80
Server name: coffee-bbd45c6-82w6t
Date: 08/May/2019:09:09:29 +0000
URI: /coffee
Request ID: a9602071f75126323a48efeb3552bb55

the ingress

kubectl get ingress

NAME           HOSTS                   ADDRESS   PORTS     AGE
cafe-ingress   test.me.at                        80, 443   62m
  • Goal: Access the service from a different machine from the browser:

ps: I also tried a curl with

curl http://test.me.at/coffee 

output

Failed connect to test.me.at:80; Connection refused

Add1: kubectl -n nginx-ingress get svc

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) default-http-backend ClusterIP 10.111.28.170 <none> 80/TCP nginx-ingress NodePort 10.101.248.204 <none> 80:31080/TCP, 443:31443/TCP

-- Mchoeti
kubernetes
kubernetes-ingress
kubernetes-service
nginx
nginx-ingress

1 Answer

5/8/2019

you should use NodePort to expose the service. If you use ClusterIp you can not curl from other machine

-- yasin lachini
Source: StackOverflow