The Nautilus DevOps team is delving into Kubernetes for app management. One team member needs to create a deployment following these details:
Create a deployment named nginx to deploy the application nginx using the image nginx:latest (ensure to specify the tag)
Note: The kubectl utility on jump_host is set up to interact with the Kubernetes cluster.
Let’s create the k3s-deployment.yml file with these contents:
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
labels:
app: nginx
spec:
selector:
matchLabels:
app: nginx
replicas: 1
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
Run the following commands to create the deployment:
kubectl apply -f k3s-deployment.yml
Verify Deployments
kubectl get deployments.apps