minikube version ⏎ minikube version: v0.22.3
I'm trying to setup various pods within a minikube instance. I'm running behind a corporate proxy which may explain some of this behavior.
I start minikube using the following
minikube start --docker-env HTTP_PROXY=http://corporate-proxy.com:80 --docker-env HTTPS_PROXY=https://corporate-proxy:80 --docker-env NO_PROXY=localhost,127.0.0.0/8,192.0.0.0/8
otherwise it wont work at all. After building some images on docker I created a two services and two pods:
---
apiVersion: v1
kind: Pod
metadata:
name: app
labels:
name: app
spec:
containers:
- name: app
image: image_app
ports:
- containerPort: 7777
volumeMounts:
- mountPath: /codeage
name: code-volume
readOnly: false
imagePullPolicy: IfNotPresent
tty: true
volumes:
- hostPath:
path: /codeage
name: code-volume
---
apiVersion: v1
kind: Pod
metadata:
name: db
labels:
name: db
spec:
containers:
- name: db
image: postgres
ports:
- containerPort: 5432
volumeMounts:
- mountPath: /var/lib/postgresql
name: db-data
imagePullPolicy: IfNotPresent
tty: true
volumes:
- hostPath:
path: /db-data
name: db-data
---
apiVersion: v1
kind: Service
metadata:
name: db
spec:
type: NodePort
ports:
- name: 'db-port'
port: 5432
targetPort: 5432
selector:
name: db
---
apiVersion: v1
kind: Service
metadata:
name: app
labels:
name: app
spec:
type: NodePort
ports:
- name: apport
port: 7777
targetPort: 7777
selector:
name: app
---
I'm unable to ping 'db' from within(ssh) the 'app' pod:
sh-4.2# ping db
PING db.default.svc.cluster.local (10.0.0.116) 56(84) bytes of data.
From chicago11-rtr-3-v411.us.corporate.com (10.60.172.X) icmp_seq=1 Destination Host Unreachable
^C
As you can see though nslookup worked and provided the correct clusterIP 10.0.0.116 and hostname 'db.default.svn.cluster.local'
I can ping the node itself. I cannot ping kube-dns...
Anyone have any ideas?
Is there an alternative to using the built in dns service?
we can't ping the service IP address, you can telnet to the port 5432
defined in the service with service IP.
@sfgroups answer is correct! ping was the wrong tool to use. Telnet or actually using psql worked. The actual problem was that my services weren't pointing to anything.
I updated my app pods to have the unique names and then updated the selector for the service.