kubernetes API object created by a deployement creation

12/12/2018

I try to see all the kubernetes object used to create a deployment. How to see theses objects created when kubectl run mydep --image=busybox ?

-- manzion_111
aws-eks
azure-aks
google-kubernetes-engine
kubectl
kubernetes

3 Answers

12/12/2018

After running kubectl run mydep --image=busybox , Existing objects can be viewed in a ready to use YAML output using below command:

  kubectl get deployments mydep --export -o yaml
-- iamejboy
Source: StackOverflow

12/12/2018

You can use kubectl to see all the deployments created using kubectl run or kubectl create.

I ran your command on my cluster and I can see following using kubectl:

[root@ip-10-0-1-91 centos]# kubectl run mydep --image=busybox
kubectl run --generator=deployment/apps.v1 is DEPRECATED and will be removed in a future version. Use kubectl run --generator=run-pod/v1 or kubectl create instead.
deployment.apps/mydep created

[root@ip-10-0-1-91 centos]# kubectl get deployments
NAME             DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
mydep            1         1         1            0           17s

[root@ip-10-0-1-91 centos]# kubectl get pods
NAME                              READY   STATUS      RESTARTS   AGE
mydep-6d67498bcf-24zh2            0/1     Completed   2          28s
-- Prafull Ladha
Source: StackOverflow

12/12/2018

while existing answers provide an answer, its best if you understand what happens, so you can have an idea how to solve such issues. take a look here: https://github.com/jamiehannaford/what-happens-when-k8s. its quite a read, but worth it.

-- 4c74356b41
Source: StackOverflow