DEV Community

Cover image for 13.Deploy Highly Available Pods with ReplicationController
Thu Kha Kyawe
Thu Kha Kyawe

Posted on

13.Deploy Highly Available Pods with ReplicationController

Lab Information

The Nautilus DevOps team is establishing a ReplicationController to deploy multiple pods for hosting applications that require a highly available infrastructure. Follow the specifications below to create the ReplicationController:

Create a ReplicationController using the httpd image with latest tag, and name it httpd-replicationcontroller.

Assign labels app as httpd_app, and type as front-end. Ensure the container is named httpd-container and set the replica count to 3.
Enter fullscreen mode Exit fullscreen mode

All pods should be running state post-deployment.

Note: The kubectl utility on jump_host is configured to operate with the Kubernetes cluster.

Lab Solutions

Step 1: Create the ReplicationController YAML file

cat > httpd-replicationcontroller.yaml <<EOF
apiVersion: v1
kind: ReplicationController
metadata:
  name: httpd-replicationcontroller
spec:
  replicas: 3
  selector:
    app: httpd_app
    type: front-end
  template:
    metadata:
      labels:
        app: httpd_app
        type: front-end
    spec:
      containers:
      - name: httpd-container
        image: httpd:latest
        ports:
        - containerPort: 80
EOF
Enter fullscreen mode Exit fullscreen mode

Explanation of the configuration:

ReplicationController name: httpd-replicationcontroller

Image: httpd:latest

Labels: app: httpd_app and type: front-end

Container name: httpd-container

Replica count: 3

Step 2: Apply the ReplicationController

kubectl apply -f httpd-replicationcontroller.yaml
Enter fullscreen mode Exit fullscreen mode

Step 3: Verify the ReplicationController was created

kubectl get replicationcontroller httpd-replicationcontroller
Enter fullscreen mode Exit fullscreen mode

Step 4: Check the pods created by the ReplicationController

kubectl get pods
Enter fullscreen mode Exit fullscreen mode

Step 5: Verify pod details and labels

kubectl describe replicationcontroller httpd-replicationcontroller
Enter fullscreen mode Exit fullscreen mode

Step 6: Verify all pods are running

kubectl get pods -l app=httpd_app,type=front-end -o wide
Enter fullscreen mode Exit fullscreen mode


Resources & Next Steps
📦 Full Code Repository: KodeKloud Learning Labs
📖 More Deep Dives: Whispering Cloud Insights - Read other technical articles
💬 Join Discussion: DEV Community - Share your thoughts and questions
💼 Let's Connect: LinkedIn - I'd love to connect with you

Credits
• All labs are from: KodeKloud
• I sincerely appreciate your provision of these valuable resources.

Top comments (0)