K8-2 Deploy Applications with Kubernetes Deployments

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 httpd to deploy the application httpd using the image httpd:latest (ensure to specify the tag)

Note: The kubectl utility on jump_host is set up to interact with the Kubernetes cluster.

kubectl create deployment httpd --image=httpd:latest
deployment.apps/httpd created

# Verify the deploymemt
kubectl get deployments
NAME    READY   UP-TO-DATE   AVAILABLE   AGE
httpd   1/1     1            1           41s

# or create a file named httpd-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: httpd
spec:
  replicas: 1
  selector:
    matchLabels:
      app: httpd
  template:
    metadata:
      labels:
        app: httpd
    spec:
      containers:
      - name: httpd
        image: httpd:latest
        ports:
        - containerPort: 80

# Apply the yaml file
kubectl apply -f httpd-deployment.yaml