kubectl run does not create replicacontroller

3/24/2016

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,

-- Ikwhan Chang
docker
google-cloud-platform
kubernetes

2 Answers

3/26/2016

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
-- Robert Bailey
Source: StackOverflow

3/24/2016

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/

-- Prashanth B
Source: StackOverflow