Skip to content

Latest commit

 

History

History
64 lines (48 loc) · 2.91 KB

deploying_application.md

File metadata and controls

64 lines (48 loc) · 2.91 KB

Deploying Applications

  • Deploying applications in Kubernetes involves creating and managing workload resources. This document will explain the different types of workload resources, provide a step-by-step guide for creating a basic deployment, and cover techniques for scaling applications horizontally and vertically.

Workload Resources

  • Pods: Pods are the basic building blocks in Kubernetes. They encapsulate one or more containers and share network and storage resources. Pods are generally not created directly; they are managed by higher-level resources like deployments or statefulsets.

  • Deployments: Deployments provide declarative updates for pods and replica sets. They ensure that the desired number of pod replicas are running and handle scaling, rolling updates, and rollbacks.

  • Replica Sets: Replica sets are responsible for maintaining a stable set of replica pods. They ensure the desired number of replicas are running at all times and can be used independently but are typically managed by deployments.

  • StatefulSets: StatefulSets are used for managing stateful applications that require stable network identities and persistent storage. They provide unique hostnames, stable network identities, and ordered deployment and scaling.

Creating a Basic Deployment

  • To create a basic deployment, follow these steps:

  • Write a YAML file describing the deployment. Include details such as the container image, port, and resource requirements.

  • Use the kubectl apply command to create the deployment from the YAML file:

kubectl apply -f deployment.yaml
  • Verify that the deployment is running by checking the status:
kubectl get deployments
  • View the created pods associated with the deployment:
kubectl get pods

Scaling Applications

  • Scaling applications in Kubernetes can be done horizontally or vertically.

Horizontal Scaling:

  • Use the kubectl scale command to scale the deployment to a desired number of replicas:
kubectl scale deployment <deployment-name> --replicas=<desired-replicas>
  • Verify the scaling:
kubectl get deployments

Vertical Scaling:

  • Edit the deployment YAML file to adjust the resource limits and requests for the containers.

  • Apply the changes to the deployment:

kubectl apply -f deployment.yaml
  • Verify the changes:
kubectl describe deployment <deployment-name>

Additional Resources

Following these steps and understanding the concepts of workload resources, deployments, and scaling will enable you to effectively deploy and manage applications in Kubernetes.