Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

kubectl run does not create replicacontroller

I'm newbie of the Kubernetes while I'm using Google Cloud Container. I just follow the tutorials as belows:

https://cloud.google.com/container-engine/docs/tutorials/http-balancer http://kubernetes.io/docs/hellonode/#create-your-pod

In these tutorials, I'll get the replicacontroller after I run the "kubectl run" but there is no replicacontrollers so that I cannot run the command of "kubectl expose rc" in order to open a port.

Here is my result of the commands:

ChangMatthews-MacBook-Pro:frontend changmatthew$ kubectl run nginx --image=nginx --port=80
deployment "nginx" created

ChangMatthews-MacBook-Pro:frontend changmatthew$ kubectl expose rc nginx --target-port=80 --type=NodePort
Error from server: replicationcontrollers "nginx" not found

Here is my result when I run "kubectl get rc,svc,ingress,deployments,pods":

ChangMatthews-MacBook-Pro:frontend changmatthew$ kubectl get rc,svc,ingress,deployments,pods
NAME                    CLUSTER-IP   EXTERNAL-IP   PORT(S)           AGE
kubernetes              10.3.240.1   <none>        443/TCP           12m
NAME                    RULE         BACKEND       ADDRESS           AGE
basic-ingress           -            nginx:80      107.178.247.247   12m
NAME                    DESIRED      CURRENT       UP-TO-DATE        AVAILABLE   AGE
nginx                   1            1             1                 1           11m
NAME                    READY        STATUS        RESTARTS          AGE
nginx-198147104-zgo7m   1/1          Running       0                 11m

One of my solution is to create yaml file which define the replicacontroller. But is there any way to create replicacontroller via kubectl run command like above tutorials?

Thanks,

like image 542
Matthew Chang Avatar asked Feb 12 '26 10:02

Matthew Chang


2 Answers

Now that kubectl run creates a deployment, you specify that the type being exposed in a deployment rather than a replication controller:

kubectl expose deployment nginx --target-port=80 --type=NodePort
like image 184
Robert Bailey Avatar answered Feb 14 '26 05:02

Robert Bailey


The team might still be updating the docs to reflect 1.2. Note the output you got:

$ kubectl run nginx --image=nginx --port=80
deployment "nginx" created

kubectl run now creates a deployemtn+replica-set. To view these you can do kubectl get deployment, and get rs respectively. Deployments are essentially a nicer way to perform rolling update server side, but there's a little more to it. See docs: http://kubernetes.io/docs/user-guide/deployments/

like image 41
Prashanth B Avatar answered Feb 14 '26 05:02

Prashanth B



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!