how can i access two containers that are inside a pod from the browser with IP address?

0 votes
I have one Kubernetes pod and inside two containers are running one is ngnix and other one is wordpress, so how can i access these two containers from the browsers with IP address?
Jul 18, 2019 in Kubernetes by Sam
• 6,260 points
180 views

1 answer to this question.

0 votes

Just do port forward.

kubectl port-forward [nginx-pod-name] 80:80

kubectl port-forward [wordpress-pod-name] drupal-port:wordpress-port

To make it permanent, you need to expose those through nodeports whenever you do kubectl port forward it adds a rule to the firewall to allow that traffic across nodes but by default that isn’t allowed since flannel or firewall probably blocks it.

Proxy tries to connect over the network of the apiserver host as you correctly found, port-forward on the other hand is a mechanism that the node kubelet exposes over its own API.

answered Jul 18, 2019 by Sirajul
• 57,940 points
not really , if those two services provide some url pattern then i can forward traffic to respective contianers with

opening an unsecure node port as the taffic directly comes to the deployed service

Related Questions In Kubernetes

0 votes
1 answer

Pods IP address from inside a container in the pod

Make sure that your pod yaml file ...READ MORE

answered Aug 29, 2018 in Kubernetes by Kalgi
• 51,950 points
575 views
0 votes
2 answers
+1 vote
1 answer

How to use a Volume to communicate between two Containers running in the same Kubernetes-Pod?

Create a Pod that runs two Containers Create a ...READ MORE

answered Jul 23, 2019 in Kubernetes by Sirajul
• 57,940 points
941 views
0 votes
1 answer

How can I stop a replicaset from restarting after deleting?

You need to delete the corresponding deployment. ...READ MORE

answered Dec 31, 2018 in Kubernetes by ajs3033
• 7,280 points
91 views
+1 vote
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17, 2019 in Others by anonymous
8,400 views
+4 votes
1 answer

Installing Web UI (Dashboard):kubernetes-dashboard on main Ubuntu 16.04.6 LTS (Xenial Xerus) server

Follow these steps: $ kubeadm reset $ kubeadm init ...READ MORE

answered Apr 11, 2019 in Kubernetes by Kalgi
• 51,950 points

reshown Apr 12, 2019 by Kalgi 2,540 views
0 votes
1 answer