Deploy Pods in Kubernetes Cluster

Deploy Pods in Kubernetes Cluster

How to Deploy Pods in a Kubernetes Cluster

Table of contents

Tasks

  • Create a pod named pod-httpd using the httpd image with the latest tag. Ensure to specify the tag as httpd:latest.

  • Set the app label to httpd_app, and name the container as httpd-container.

Steps

  1. Create a pod called pod-httpd using the httpd image with the latest tag, ensuring the tag is specified as httpd:latest.

    • Create a yaml file
cat > pod-httpd.yaml <<EOF
apiVersion: v1
kind: Pod
metadata:
  name: pod-httpd
  labels:
    app: httpd_app
spec:
  containers:
  - name: httpd-container
    image: httpd:latest
EOF

apiVersion: v1
kind: Pod
metadata:
  name: pod-httpd
  labels:
    app: httpd_app
spec:
  containers:
  - name: httpd-container
    image: httpd:latest
  1. You can apply this configuration with this command.

     kubectl apply -f pod-httpd.yaml
    

    1. To ensure or check the create pods.

       kubectl get pods
      

      #k8s #pods #devops