Welcome to the Linux Foundation Forum!

Difference in a requesting objects in kubernetes

davidfedor
davidfedor Posts: 3
edited September 2021 in LFD259 Class Forum

Can anybody help to find answer to a question what is the difference requesting deployment object like this two ways?

kubectl get deployment name-of-deployment
kubectl get deployments.apps name-of-deployment

I have seen this ways of requesting also in the labs e.g.
student@cp: ̃$ kubectl create deployment design2 --image=nginx
student@cp: ̃$ kubectl get deployments.apps design2 -o wide

Best Answer

  • chrispokorni
    chrispokorni Posts: 2,320
    Answer ✓

    Hi @davidfedor,

    There should be no difference between kubectl get deployment and kubectl get deployments.apps commands. The API object type can include the API group, such as .apps, added by the kubectl autocompletion feature.

    Did you happen to notice any differences in output?

    Regards,
    -Chris

Answers

  • Also similar selection seen at cronjobs:
    student@cp: ̃$ kubectl get cronjobs.batch

  • @chrispokorni thanks, no I forgot to mention that the result was actually the same, so I just wanted to know whether it has something to do with more then just executing the same thing in a different way. So thank you!

  • Hi @davidfedor,

    A feature that may look confusing, but helpful when using API resources that are maturing, or may be migrating between API groups. Being able to see the API group confirms the use of the desired API object definition with all relevant properties and features.

    Regards,
    -Chris

Categories

Upcoming Training