Run and Operate It
Visit, scale, update, roll back.
A running application is only the beginning. Now we operate it. We visit it, scale it up for a busy day, ship a new version, and undo a mistake. The same moves you will make every week in real life.

- Visit the shop
- Scale for a busy day
- Update and roll back
Visiting the shop
Let's visit. We open a tunnel to the ingress controller, and send requests, with the host name, shop dot local. The root path returns the web page, from our config map. The slash A P I path returns the message of the A P I. Two services, behind one front door. That is a working application.
kubectl port-forward -n ingress-nginx svc/ingress-nginx-controller 8081:80 tunnel ready curl -s -H 'Host: shop.local' localhost:8081/ <h1>Welcome to the Shop</h1> curl -s -H 'Host: shop.local' localhost:8081/api Shop API is running
File used: 01-data.yaml
apiVersion: v1
kind: Namespace
metadata:
name: shop
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis
namespace: shop
spec:
replicas: 1
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
image: redis:7-alpine
ports:
- containerPort: 6379
---
apiVersion: v1
kind: Service
metadata:
name: redis
namespace: shop
spec:
selector:
app: redis
ports:
- port: 6379File used: 02-api.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: api
namespace: shop
spec:
replicas: 2
selector:
matchLabels:
app: api
template:
metadata:
labels:
app: api
spec:
containers:
- name: api
image: hashicorp/http-echo:1.0
args: ["-text=Shop API is running"]
ports:
- containerPort: 5678
readinessProbe:
httpGet:
path: /
port: 5678
resources:
requests:
cpu: 50m
memory: 32Mi
limits:
memory: 64Mi
---
apiVersion: v1
kind: Service
metadata:
name: api
namespace: shop
spec:
selector:
app: api
ports:
- port: 80
targetPort: 5678File used: 03-web.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: web-html
namespace: shop
data:
index.html: "<h1>Welcome to the Shop</h1>"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
namespace: shop
spec:
replicas: 2
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: web
image: nginx:1.27
volumeMounts:
- name: html
mountPath: /usr/share/nginx/html
volumes:
- name: html
configMap:
name: web-html
---
apiVersion: v1
kind: Service
metadata:
name: web
namespace: shop
spec:
selector:
app: web
ports:
- port: 80File used: 04-ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: shop
namespace: shop
spec:
ingressClassName: nginx
rules:
- host: shop.local
http:
paths:
- path: /api
pathType: Prefix
backend:
service:
name: api
port:
number: 80
- path: /
pathType: Prefix
backend:
service:
name: web
port:
number: 80Scale and update
Now, a busy day. We scale the A P I to four replicas, with one command, and list the pods. Four pods, spread over the nodes. Next, a new release of the web tier. We change its image, which starts a rolling update, and wait for it to finish. The shop stays online, throughout. And finally, imagine the new version is bad. One command, rollout undo, returns to the previous version. You have just run a deployment, as a professional.
kubectl scale deployment api -n shop --replicas=4 deployment.apps/api scaled kubectl get pods -n shop -l app=api NAME READY STATUS RESTARTS AGE api-7f887f48b-9plqj 1/1 Running 0 39s api-7f887f48b-db9gp 1/1 Running 0 10s api-7f887f48b-gk9hg 1/1 Running 0 10s api-7f887f48b-zfbzp 1/1 Running 0 39s kubectl set image deployment/web web=nginx:1.25 -n shop deployment.apps/web image updated kubectl rollout status deployment/web -n shop Waiting for deployment "web" rollout to finish: 1 out of 2 new replicas have been updated... Waiting for deployment "web" rollout to finish: 1 old replicas are pending termination... deployment "web" successfully rolled out kubectl rollout undo deployment/web -n shop deployment.apps/web rolled back
File used: 01-data.yaml
apiVersion: v1
kind: Namespace
metadata:
name: shop
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis
namespace: shop
spec:
replicas: 1
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
image: redis:7-alpine
ports:
- containerPort: 6379
---
apiVersion: v1
kind: Service
metadata:
name: redis
namespace: shop
spec:
selector:
app: redis
ports:
- port: 6379File used: 02-api.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: api
namespace: shop
spec:
replicas: 2
selector:
matchLabels:
app: api
template:
metadata:
labels:
app: api
spec:
containers:
- name: api
image: hashicorp/http-echo:1.0
args: ["-text=Shop API is running"]
ports:
- containerPort: 5678
readinessProbe:
httpGet:
path: /
port: 5678
resources:
requests:
cpu: 50m
memory: 32Mi
limits:
memory: 64Mi
---
apiVersion: v1
kind: Service
metadata:
name: api
namespace: shop
spec:
selector:
app: api
ports:
- port: 80
targetPort: 5678File used: 03-web.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: web-html
namespace: shop
data:
index.html: "<h1>Welcome to the Shop</h1>"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
namespace: shop
spec:
replicas: 2
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: web
image: nginx:1.27
volumeMounts:
- name: html
mountPath: /usr/share/nginx/html
volumes:
- name: html
configMap:
name: web-html
---
apiVersion: v1
kind: Service
metadata:
name: web
namespace: shop
spec:
selector:
app: web
ports:
- port: 80File used: 04-ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: shop
namespace: shop
spec:
ingressClassName: nginx
rules:
- host: shop.local
http:
paths:
- path: /api
pathType: Prefix
backend:
service:
name: api
port:
number: 80
- path: /
pathType: Prefix
backend:
service:
name: web
port:
number: 80What you practised
Look at what this small shop used. Namespaces, deployments, services, a config map, probes, resource requests, an ingress, scaling, rolling updates, and rollbacks. Real production systems add more, secrets, storage, autoscaling, policies, monitoring, and Git ops, but the foundation is the same. If you can build and operate this shop confidently, you can learn the rest quickly.
Summary
Excellent. You planned, built, ran, scaled, updated, and rolled back a complete application. That is the real skill. Next, a short quiz, to check what you remember, and tips for certification.
Key takeaways- Plan, build in layers
- Visit, scale, update
- Roll back mistakes