deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-world
labels:
app: hello-world
spec:
replicas: 4
selector:
matchLabels:
app: hello-world
template:
metadata:
labels:
app: hello-world
spec:
containers:
- name: hello-world
image: gcr.io/google-samples/hello-app:1.0
ports:
- containerPort: 8080
#Let's ask the API Server for the API Groups it knows about.
kubectl api-resources | more
#A list of the objects available in that API Group
kubectl api-resources --api-group=apps
#We can use explain to dig further into a specific API Object
#Check out KIND and VERSION, we'll see the API Group in the from group/version
#Which is extensions/v1beta1 and that's deprecated.
kubectl explain deployment | head
#Follow the version specified in the deprecation warning. That's deprecated too!
kubectl explain deployment --api-version apps/v1beta2 | head
#Follow the version specified in THAT deprecation warning. Ah...the one we should use.
kubectl explain deployment --api-version apps/v1 | head
#Print the supported API versions on the API server again in the form group/version.
#Here we see apps/v1,apps/v1beta1 and apps/v1beta2
kubectl api-versions | sort | more
#Now, we're in a transition period of where Deployments are moving from v1beta1, to v1beta2 to apps/v1
#Deployment went GA under apps/v1 in version 1.9, as of 1.13 it's still a work in progress.
#Follow the issue on GitHub - https://github.com/kubernetes/kubernetes/issues/43214
kubectl apply -f deployment.yaml
#Our 1.13 API Server converts apiVersion to v1beta1
#let's look at a Deployment
kubectl get deployment hello-world -o yaml | head
#Let's clean up after this demo
kubectl delete deployment hello-world
Code language: PHP (php)












I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I have worked at Cotocus. I share tech blog at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow , and SEO strategies at Wizbrand.
Do you want to learn Quantum Computing?
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at WIZBRAND