Evolution of application deployment over the past 20 years.
Configure your local and remote lab environments.
Covers the resource types that are included with Kubernetes.
•Pod
•Job
Using helm to manage Kubernetes resources
Example microservice application.
Kubernetes manifests to deploy the demo application.
Explore how custom resources can add functionality
Install additional software to enhance the deployment.
Improving the DevX when working with Kubernetes.
How to safely upgrade your clusters and nodes.
Implement CI/CD for your applications (with GitOps!)
In Kubernetes, a Deployment
provides declarative updates to applications. It manages the creation and scaling of ReplicaSets
, and allows for controlled, rolling updates to your applications. Deployments
are a higher-level concept that includes many additional features beyond what ReplicaSets
offer.
If you are deploying stateless applications on Kubernetes, a Deployment
is generally the resource type you should use.
Official docs: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/
We will create and examine a Deployment
to understand its behavior.
First, we'll create a namespace for these examples and set it as the default.
# task 01-create-namespace
# - Create a namespace for these examples and set as default.
kubectl apply -f Namespace.yaml
kubens 04--deployment
Next, we'll apply Deployment
configuration containing 3 replicas of a Pod
containing an nginx container image.
# task 03-apply-better
# - Apply the better Deployment configuration.
kubectl apply -f Deployment.nginx-better.yaml
You will notice that within the Deployment
definition, the spec looks identical to that of our ReplicaSet
from the previous lesson. This is because a Deployment
ends up deploying a ReplicaSet
but adds the following functionality:
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-better
namespace: 04--deployment
labels:
app: nginx-better
spec:
replicas: 3
selector:
matchLabels:
app: nginx-better
template:
metadata:
labels:
app: nginx-better
spec:
containers:
- name: nginx
image: cgr.dev/chainguard/nginx:latest
ports:
- containerPort: 8080
protocol: TCP
readinessProbe:
httpGet:
path: /
port: 8080
resources:
limits:
memory: "50Mi"
requests:
memory: "50Mi"
cpu: "250m"
securityContext:
allowPrivilegeEscalation: false
privileged: false
securityContext:
seccompProfile:
type: RuntimeDefault
runAsUser: 1001
runAsGroup: 1001
runAsNonRoot: true
To demonstrate a rolling update, we'll roll the pods in one of the Deployments. This simulates updating your application to a new version.
# task 04-rollout-restart
# - Roll the pods in one of the deployments
kubectl rollout restart deployment nginx-better
watch "kubectl get pods"
Finally, clean up by deleting the namespace, which will also delete all resources within it.
# task 05-delete-namespace
# - Delete the namespace to clean up.
kubectl delete -f Namespace.yaml