Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Kubernetes Commands: kubectl api-versions – Tutorials and Examples

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

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.