Skip to main content

🚀 Deploy

A Deployment is the standard way to run an application on the cluster. You say which image to use and how many copies (replicas) you want, and Kubernetes creates the pods and keeps them running: if a pod goes down, it creates another.

Deployment  ->  ReplicaSet  ->  Pods
info

Deployment is done with kubectl. The Nuvion Panel takes care of the cluster, but does not create applications inside it.


🚀 Before you start​

🚀 1. Create the Deployment file​

Create the file deploy-web.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
name: web-deploy
spec:
replicas: 2
selector:
matchLabels:
app: web-deploy
template:
metadata:
labels:
app: web-deploy
spec:
containers:
- name: nginx
image: nginx:1.26
ports:
- containerPort: 80
resources:
requests:
cpu: 100m
memory: 64Mi
limits:
cpu: 250m
memory: 128Mi
readinessProbe:
httpGet:
path: /
port: 80

What each part does:

FieldPurpose
replicasHow many pods to keep running
imageThe container image (and version)
requestsThe minimum resources the pod needs
limitsThe maximum resources the pod can use
readinessProbeOnly sends traffic to the pod after it responds

🚀 2. Apply​

kubectl apply -f deploy-web.yaml

Expected output: deployment.apps/web-deploy created

🚀 3. Verify​

kubectl get deployment web-deploy
kubectl get pods -l app=web-deploy

Wait for the READY column to show 2/2 and the pods to be Running.

🚀 4. See the automatic recreation​

Delete one of the pods and watch:

kubectl delete pod NAME-OF-ONE-OF-THE-PODS
kubectl get pods -l app=web-deploy

Kubernetes creates a new pod to keep 2 replicas.

🚀 5. Expose the application​

To access the Deployment, create a Service (see the Services page):

kubectl expose deployment web-deploy --name=web-deploy-svc --port=80

✅ How to know it worked​

kubectl get deployment web-deploy shows READY 2/2 and AVAILABLE 2.

❗ Common problems​

SymptomCauseSolution
READY 0/2Pods did not startSee kubectl describe pod and Events
ImagePullBackOffImage or version does not existCheck the name and tag in image
selector does not match template labelsmatchLabels differs from labelsUse the same label in both
Pods PendingNo resources on the nodesReduce requests or increase capacity (Scale)

🧹 Cleanup​

Keep the Deployment for the next Operations pages. When you are done:

kubectl delete svc web-deploy-svc
kubectl delete deployment web-deploy

➡️ Next step: Scale

🧠 Questions?​

Talk to our SaveinCloud technical support team!