Skip to content

Instantly share code, notes, and snippets.

@schewara
Created December 3, 2019 18:22
Show Gist options
  • Save schewara/02b0e23dd56b5829a0a700d2e9a14d1a to your computer and use it in GitHub Desktop.
Save schewara/02b0e23dd56b5829a0a700d2e9a14d1a to your computer and use it in GitHub Desktop.
kubernetes dns resolution test
working nslookup task
#### test.yaml ####
---
apiVersion: v1
kind: Service
metadata:
name: mywebserver
spec:
selector:
app: nginx
ports:
- port: 80
name: whateve
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 2
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 2
maxUnavailable: 1
selector:
matchLabels:
app: nginx
template:
metadata:
name: nginx
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
---
apiVersion: v1
kind: Pod
metadata:
name: busybox2
namespace: default
spec:
containers:
- name: busy
image: busybox
command:
- sleep
- "3600"
#### cmd ####
$ kubectl exec -ti busybox2 -- nslookup mywebserver
Server: 10.96.0.10
Address: 10.96.0.10:53
Name: mywebserver.default.svc.cluster.local
Address: 10.101.105.151
*** Can't find mywebserver.svc.cluster.local: No answer
*** Can't find mywebserver.cluster.local: No answer
*** Can't find mywebserver.default.svc.cluster.local: No answer
*** Can't find mywebserver.svc.cluster.local: No answer
*** Can't find mywebserver.cluster.local: No answer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment