Himanshu1310
Himanshu1310

Reputation: 23

Get Externally accessible IP address of Pod in Kubernetes

I need to create two instances using the same Ubuntu Image in Kubernetes. Each instance used two ports i.e. 8080 and 9090. How can I access these two ports externally? Can we use the IP address of the worker in this case?

Upvotes: 1

Views: 1546

Answers (1)

mlewinska
mlewinska

Reputation: 276

If you want to access your Ubuntu instances from outside the k8s cluster you should place pods behind the service.

You can access services through public IPs:

  • create Service of type NodePort- the service will be available on <NodeIp>:<NodePort>
  • create Service of type LoadBalancer - if you are running your workload in the cloud creating service of type LoadBalancer will automatically deploy LoadBalancer for you.

Alternatively you can deploy Ingress to expose your Service. You would also need Ingress Controller.

Useful links:

Upvotes: 3

Related Questions