Skip to main content

Command Palette

Search for a command to run...

Deploy Pods in Kubernetes Cluster

How to Deploy Pods in a Kubernetes Cluster

Published
1 min read
Deploy Pods in Kubernetes Cluster
A

Infosec Poet and CAP-certified DevOps/SecOps Engineer, passionate about security, creativity, and continuous learning.

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

DevOps

Part 9 of 10

In this series, I will cover various DevOps practices, tools, CI/CD pipelines, infrastructure as code, automation tips, and troubleshooting techniques.

Up next

Hide Nginx Server Information for Better Security

Hiding version of nginx server on the website