K8s environment test coredns domain name resolution demo file

apiVersion: v1
kind: Pod
metadata:
name: pod-demo
namespace: default
labels:
app: myapp
tier: frontend
spec:
containers:

  • name: busybox
    image: busybox:latest
    command:
    • “/bin/sh”
    • “-c”
    • “sleep 3600”

Step 1: Run this yaml file
Step 2: Enter this pod
kubectl exec -it pod-demo bash Enter pod
Step 3: Test whether the domain name resolution is normal
ping kubernetes.default It is normal that the following information appears
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_34939308/article/details/114024563