

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 4
click for more info
Not enough gems
Cost: 6 gems
1: The Control Plane
incomplete
2: Labels
incomplete
3: Dry Run
incomplete
4: Kubectl Explain
incomplete
5: Rollouts
incomplete
6: Rollbacks
incomplete
7: API Deployment
incomplete
8: Thrashing Pods
incomplete
This lesson's interactive features are locked, please to keep using them
Remember, the kubectl get -o yaml command gives you the .yaml that defines a resource... but it can be noisy. It's full of fields that Kubernetes filled in for us, like status, uid, resourceVersion, and creationTimestamp. Those things don't belong in your repo that stores configs, and if you commit a stale resourceVersion, it can actually make kubectl apply fail with a Conflict error.
Instead, you want to have kubectl generate a clean manifest. The --dry-run=client flag tells kubectl not to send anything to the cluster, and -o yaml prints what it would have created:
kubectl create deployment synergychat-web --image=bootdotdev/synergychat-web:latest --replicas=3 --dry-run=client -o yamlapiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: synergychat-web
name: synergychat-web
spec:
replicas: 3
selector:
matchLabels:
app: synergychat-web
strategy: {}
template:
metadata:
labels:
app: synergychat-web
spec:
containers:
- image: bootdotdev/synergychat-web:latest
name: synergychat-web
resources: {}
status: {}--dry-run=client works with kubectl apply too. It checks that your file is valid and tells you what it would do, without actually doing it.
kubectl create deployment synergychat-web --image=bootdotdev/synergychat-web:latest --replicas=3 --dry-run=client -o yaml > web-deployment.yamlkubectl apply -f web-deployment.yaml --dry-run=clientSubmit the shell checks.