Thursday, 2 October 2025

Create a Kubernetes Deployment for Apache HTTP Server (httpd:latest)

Our course you can check :-   Udemy course


Que:-  

DevOps team is looking 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) 


Ans:- 

raj@jumphost ~$ cat abc.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-container

        image: httpd:latest

raj@jumphost ~$ 

raj@jumphost ~$ 

raj@jumphost ~$ kubectl apply -f abc.yaml 

deployment.apps/httpd created

raj@jumphost ~$ kubectl get deploy

NAME    READY   UP-TO-DATE   AVAILABLE   AGE

httpd   1/1     1            1           10s

raj@jumphost ~$ kubectl get pods

NAME                    READY   STATUS    RESTARTS   AGE

httpd-8fd98cfbb-9kvm8   1/1     Running   0          21s

No comments:

Post a Comment