Hello I am starting on the CKA course.. how do you know what `apiVersion` to set . . .

Amulya Sreeramaneni:
Hello I am starting on the CKA course… how do you know what apiVersion to set… we use v1 & app/v1. What is the difference between them. If there is a lecture that states this feel free to point it. Thank you in advance.

Marko Eremija:
Those are different API Groups: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#-strong-api-groups-strong-. Depending on the type, different K8s objects belong to different API Groups. You can also see which objects (e.g., Deployment, Pod etc.) belong to which API Groups from the CLI by running kubectl api-resources

Alistair Mackay:
They are logically grouped e.g:
• Core API for the most basic resources like pods is just v1
• Application resources (deployments, statefulsets etc) are apps/v1
• Job resources (Job, CronJob etc) are batch/v1
and so on.
There is a lecture about this in Mumshad’s course.

chris resnik:
if unsure, use an imperative command to output a yaml file for whatever resource you are working on, it will include the correct apiversion

chris resnik:
might apply more for CKAD than CKA maybe

unnivkn:
Hi @Amulya Sreeramaneni please try to use as much as imperative commands, so that you don’t need to worry about apiVersion. As per the k8s version it will be created for you. Also you can refer the declarative commands from the docs as per the k8s version you are using. https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#-em-deployment-em-

Amulya Sreeramaneni:
thank you all !