A deployment represents
one or more identical pods, managed by the Kubernetes Deployment
Controller. A deployment defines the number of replicas (pods)
to create, and the Kubernetes Scheduler ensures that if pods or nodes
encounter problems, additional pods are scheduled on healthy nodes.
You
can update deployments to change the configuration of pods, container
image used, or attached storage. The Deployment Controller drains and
terminates a given number of replicas, creates replicas from the new
deployment definition, and continues the process until all replicas
in the deployment are updated.
Most
stateless applications in AKS should use the deployment model rather
than scheduling individual pods. Kubernetes can monitor the health
and status of deployments to ensure that the required number of
replicas run within the cluster. When you only schedule individual
pods, the pods aren't restarted if they encounter a problem, and
aren't rescheduled on healthy nodes if their current node encounters
a problem.
If
an application requires a quorum of instances to always be available
for management decisions to be made, you don't want an update process
to disrupt that ability. Pod
Disruption Budgets can
be used to define how many replicas in a deployment can be taken down
during an update or node upgrade. For example, if you have 5 replicas
in your deployment, you can define a pod disruption of 4 to
only permit one replica from being deleted/rescheduled at a time. As
with pod resource limits, a best practice is to define pod disruption
budgets on applications that require a minimum number of replicas to
always be present.
Deployments
are typically created and managed with
kubectl
create or kubectl
apply.
To create a deployment, you define a manifest file in the YAML (YAML
Ain't Markup Language) format. The following example creates a basic
deployment of the NGINX web server. The deployment
specifies 3 replicas
to be created, and that port 80 be
open on the container. Resource requests and limits are also defined
for CPU and memory.
0
comments



