I cannot talk to a pod from side car container... any help will be appreciated!
Here's my deployment
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: sidecar-deployment
spec:
replicas: 1
template:
metadata:
labels:
app: sidecar
spec:
containers:
- name: sidecar1
image: sidecar
args:
- /sidecar
- --port=32000
- --path=/sidecar1
ports:
- containerPort: 32000
- name: sidecar2
image: sidecar
args:
- /sidecar
- --port=32001
- --path=/sidecar2
ports:
- containerPort: 32001
And here's my service to the pod
---
apiVersion: v1
kind: Service
metadata:
name: sidecar-service
spec:
ports:
- name: http
port: 80
targetPort: 32001
protocol: TCP
selector:
app: sidecar
type: NodePort
After deploying ingress, I can connect to the service and sidecar2, because sidecar2 is exposed via service:
# this works
curl -L http://ADDR/sidecar2
But, I was expecting to be able to curl to the side container, but I can't.
This is what I did. I ssh into the sidecar container. And curl the colocated pod with localhost
:
kubectl exec -it sidecar2 -- /bin/bash
# this doesn't work
curl -L http://localhost:32000/sidecar1
Can somebody help me on this?
Thanks!
curl -L http://pod-id:32000/sidecar1
– Arce