questions related kubernetes

root@techresource1:~# kubectl get nodes

NAME STATUS ROLES AGE VERSION

techresource1.mylabserver.com Ready master 3m49s v1.12.1

root@techresource1:~#

root@techresource1:~# kubectl run nginx --image=nginx

kubectl run --generator=deployment/apps.v1beta1 is DEPRECATED and will be removed in a future version. Use kubectl create instead.

Error from server (AlreadyExists): deployments.apps "nginx" already exists

root@techresource1:~#

i would like to use kubectl run command instead kubectl create

  • post-author-pic
    linuxacademio
    11-08-2018

    what is your question specifically?  If you need more guidance with the --generator, i would recommend the K8s.io site for some hands on example. 

  • post-author-pic
    Will B
    11-08-2018

    It looks like you are using a duplicate name for the deployment. There is already a deployment in the cluster called "nginx," and you are trying to call the new deployment "nginx" as well.


    kubectl run creates a deployment behind the scenes. If you don't need that existing deployment, you can delete it with 

    kubectl delete deployment nginx

    If you want to keep the old deployment, use a different name for the new one, for example (with the name nginx2):

    kubectl run nginx2 --image=nginx

  • post-author-pic
    Tech R
    11-08-2018

    Why i am getting below message when i use kubectl run command to create pod

    kubectl run --generator=deployment/apps.v1beta1 is DEPRECATED and will be removed in a future version. Use kubectl create instead.


  • post-author-pic
    Will B
    11-08-2018

    That message just means that the kubectl run command will be removed in a future version of Kubernetes. It's just a warning, and you can ignore it for now if you want. If you plan to continue using Kubernetes in the future, familiarize yourself with using "kubectl create" commands instead, since those are replacing "kubectl run".

Looking For Team Training?

Learn More