Creating a Service and Discovering DNS Names in Kubernetes

Create an nginx deployment, and verify it was successful

Use this command to create an nginx deployment:

kubectl run nginx --image=nginx

Use this command to verify deployment was successful:

Create a service, and verify the service was successful

Use this command to create a service:

Use this command to verify the service was created:

Create a pod that will allow you to query DNS, and verify it’s been created

Use the following YAML to create the busybox pod spec:

busybox.yaml

Use the following command to create the busybox pod:

Use the following command to verify the pod was created successfully:

Perform a DNS query to the service

Use the following command to query the DNS name of the nginx service:

Record the DNS name

Record the name:

Last updated