Introduction
In this challenge, you will be tasked with deploying a Kubernetes pod running the latest Nginx web server. Your goal is to ensure the pod is up and running and accessible through a service. You will need to create a Kubernetes YAML file to deploy the pod and a service of type NodePort to expose the Nginx pod.
Deploy Nginx Pod
As a new DevOps engineer, you've been tasked with deploying a Kubernetes pod running the latest Nginx web server. Your goal is to ensure the pod is up and running and accessible through a service.
Tasks
- Create a Kubernetes YAML file to deploy a pod running the latest Nginx container.
- Create a service of type NodePort to expose the Nginx pod.
Requirements
- Create the Kubernetes YAML file in the
~/projectdirectory. - Name the YAML file
nginx-pod.yaml. - The Nginx container image version must be the latest.
- The service must be of type
NodePort.
Examples
Example YAML file content:
apiVersion: v1
kind: Pod
metadata:
name: nginx-pod
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
selector:
app: nginx
type: placeholder
ports:
- port: 80
targetPort: 80
Example service access URL:
http://<node-ip>:<node-port>
Hints
- Use
kubectlcommands to interact with the Kubernetes cluster. - Ensure the pod is running and the service is exposing the pod correctly.
Summary
In summary, this challenge requires you to deploy a Kubernetes pod running the latest Nginx web server and create a service to expose the pod. You will need to create a Kubernetes YAML file to define the pod and service, ensuring the pod is up and running and accessible through the NodePort service.


