I was going through another challenge on killercoda but even after the right steps, verification fails. Can someone confirm if I did the right steps?
controlplane $ kubectl run nginx-pod-cka --image=nginx --dry-run=client -o yaml > nginx-pod-cka.yaml
controlplane $ vi nginx-pod-cka.yaml
controlplane $ cat nginx-pod-cka.yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: nginx-pod-cka
name: nginx-pod-cka
spec:
containers:
- image: nginx
name: nginx-pod-cka
ports:
- containerPort: 80
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}
controlplane $ kubectl create -f nginx-pod-cka.yaml
pod/nginx-pod-cka created
controlplane $ kubectl expose pod nginx-pod-cka --port 80 --target-port 80 --name nginx-service-cka --dry-run=client -o yaml > nginx-service-cka.yaml
controlplane $ vi nginx-service-cka.yaml
controlplane $ cat nginx-service-cka.yaml
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
run: nginx-pod-cka
name: nginx-service-cka
spec:
type: ClusterIP
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
run: nginx-pod-cka
status:
loadBalancer: {}
controlplane $ kubectl apply -f nginx-service-cka.yaml
service/nginx-service-cka created
controlplane $ kubectl get po,svc
NAME READY STATUS RESTARTS AGE
pod/nginx-pod-cka 1/1 Running 0 81s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 19d
service/nginx-service-cka ClusterIP 10.99.222.177 <none> 80/TCP 4s
controlplane $ cp nginx-pod-cka.yaml busybox.yaml
controlplane $ vi busybox.yaml
controlplane $ cat busybox.yaml
apiVersion: v1
kind: Pod
metadata:
name: busybox
spec:
containers:
- image: busybox:1.28
name: nginx-pod-cka
command: ["sleep", "3600"]
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}
controlplane $ kubectl apply -f busybox.yaml
pod/busybox created
controlplane $ kubectl get po,svc
NAME READY STATUS RESTARTS AGE
pod/busybox 1/1 Running 0 9s
pod/nginx-pod-cka 1/1 Running 0 2m26s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 19d
service/nginx-service-cka ClusterIP 10.99.222.177 <none> 80/TCP 69s
controlplane $ kubectl exec busybox -- nslookup nginx-service-cka
Server: 10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local
Name: nginx-service-cka
Address 1: 10.99.222.177 nginx-service-cka.default.svc.cluster.local
controlplane $ kubectl exec busybox -- nslookup nginx-service-cka > nginx-service.txt
controlplane $ cat nginx-service.txt
Server: 10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local
Name: nginx-service-cka
Address 1: 10.99.222.177 nginx-service-cka.default.svc.cluster.local
controlplane $
````Preformatted text`