Deployment Example
Download the YAML configuration file for the hello-app deployment
Create V1 Deployment
Creates the initial deployment using the YAML configuration file.
Get Deployment Status
Checks the rollout status of the deployment.
Get Pods List
Lists all pods with additional details like IP addresses and nodes.
Describe Pod
Shows detailed information about a specific pod.
Get ReplicaSets
Lists all ReplicaSets to see how many are created.
Create V2 Deployment
Applies the updated YAML configuration (after changing version to 2.0).
Get Deployment Status
Checks the rollout status of the deployment.
Get Pods List
Lists all pods with additional details like IP addresses and nodes.
Get ReplicaSets
Lists all ReplicaSets to see how many are created.
Get Deployment History
Shows the rollout history of the deployment.
Rollback Deployment
Rolls back to the Previous deployment version.
Rolls back to the Specific deployment version.
Get Deployment Status
Checks the rollout status of the deployment.
Get ReplicaSets
Lists all ReplicaSets to see how many are created.
Cleanup
Deletes all resources defined in the YAML configuration file.
YAML Configuration File
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-dep
namespace: default
spec:
replicas: 3
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
selector:
matchLabels:
app: hello-dep
template:
metadata:
labels:
app: hello-dep
spec:
containers:
- image: guybarrette/hello-app:1.0
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
imagePullPolicy: Always
name: hello-dep
ports:
- containerPort: 8080
YAML Configuration Explanation:
Deployment Structure:
- apiVersion: apps/v1 → Specifies the Kubernetes API version for Deployments
- kind: Deployment → Defines this as a Deployment resource
- metadata.name: hello-dep → Names the deployment "hello-dep"
- namespace: default → Places the deployment in the default namespace
Deployment Spec:
- replicas: 3 → Maintains 3 identical pod instances
- strategy.type: RollingUpdate → Uses rolling update for deployments
- rollingUpdate.maxSurge: 1 → Allows 1 extra pod during update
- rollingUpdate.maxUnavailable: 1 → Allows 1 pod to be unavailable during update
- selector.matchLabels.app: hello-dep → Selects pods with label app=hello-dep
Pod Template:
- metadata.labels.app: hello-dep → Labels the pods with app=hello-dep
- spec.containers → Defines the container specifications
Container Configuration:
- image: guybarrette/hello-app:1.0 → Uses version 1.0 of the hello-app image
- resources.requests.cpu: 100m → Requests 0.1 CPU cores
- resources.requests.memory: 128Mi → Requests 128MB of memory
- resources.limits.cpu: 250m → Limits to 0.25 CPU cores
- resources.limits.memory: 256Mi → Limits to 256MB of memory
- imagePullPolicy: Always → Always pulls the image when starting a pod
- name: hello-dep → Names the container "hello-dep"
- containerPort: 8080 → Exposes port 8080 on the container
How It Works:
This deployment creates and manages 3 replicas of a pod running the hello-app container. The RollingUpdate strategy ensures zero-downtime deployments by gradually replacing old pods with new ones. The resource requests and limits help Kubernetes schedule the pods appropriately and prevent resource exhaustion.