Kubernetes Deployment for App Deployment

Deploy Applications with Kubernetes Deployments

Deploy Applications with Kubernetes Deployments

How to Deploy Apps Using Kubernetes Deployments

Tasks

  • Create a deployment named httpd.

  • Deploy the application httpd.

  • Use the image httpd:latest (make sure to specify the tag).

Steps

  1. Make yaml file or you can try EOF. Personally I like using EOF. (Alternatively, you can try vim/ nano anything.

     cat > httpd-deployment.yaml <<EOF
     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
     EOF
  2. Now apply the yaml file

     kubectl apply -f httpd-deployment.yaml
  3. Apply the deployment with the following command:

     kubectl apply -f httpd-deployment.yaml
  4. To check if the deployment is created, run:

     kubectl get deployments
  5. To make sure to specify the tag (latest)

    • As we already have deployment named httpd.

    kubectl describe deployment httpd

#k8s #devops #deployments #happylearning