Cannot set up Kubernetes local cluster via Docker

I followed Here are the commands I literally run:

export K8S_VERSION=$(curl -sS
export ARCH=amd64
docker run -d \
--volume=/:/rootfs:ro \
--volume=/sys:/sys:rw \
--volume=/var/lib/docker/:/var/lib/docker:rw \
--volume=/var/lib/kubelet/:/var/lib/kubelet:rw \
--volume=/var/run:/var/run:rw \
--net=host \
--pid=host \
--privileged \${ARCH}:${K8S_VERSION} \
/hyperkube kubelet \
    --containerized \
    --hostname-override= \
    --api-servers=http://localhost:8080 \
    --config=/etc/kubernetes/manifests \
    --cluster-dns= \
    --cluster-domain=cluster.local \
    --allow-privileged --v=2
curl -sSL "" > /usr/bin/kubectl
chmod +x /usr/bin/kubectl
kubectl config set-cluster test-doc --server=http://localhost:8080
kubectl config set-context test-doc --cluster=test-doc
kubectl config use-context test-doc

Then I followed

  • Stop Minecraft server in Docker when container stops
  • Docker port binding error
  • how does Docker Embedded DNS resolver work?
  • Can't connect to database with docker-compose with mysql and php 7
  • Rails docker - Bundle with custom path not able to access gems
  • Docker compose error while creating a portus demo environment why?
  • kubectl create -f web-service.yaml
    kubectl create -f web-controller.yaml
    kubectl create -f mongo-service.yaml
    kubectl create -f mongo-controller.yaml

    I have a Python flask app, so I replace the image with my own and the args with ['export DOCKER=True && cd commandcenter/ && python']

    This is the reult of kubectl get services:

    kubernetes     <none>        443/TCP     3d
    mongo   <none>        27017/TCP   14m
    web                 80/TCP      6m

    Reult of kubectl get pods:

    NAME                     READY     STATUS    RESTARTS   AGE
    k8s-etcd-       1/1       Running   0          3d
    k8s-master-     4/4       Running   0          3d
    k8s-proxy-      1/1       Running   0          3d
    mongo-controller-3b8q5   1/1       Running   0          5m
    nginx-198147104-9w444    1/1       Running   0          25m
    web-controller-6nzpn     1/1       Running   3          2m
    web-controller-uot1s     1/1       Running   3          2m

    Result of kubectl logs web-controller-6nzpn:

    DEBUG 2016-06-09 17:57:49,279 Starting up server 
    INFO 2016-06-09 17:57:49,285  * Running on (Press CTRL+C to quit)

    Result of kubectl get nodes:

    NAME        STATUS    AGE   Ready     3d

    Result of docker ps:

    CONTAINER ID        IMAGE                                             COMMAND                  CREATED             STATUS              PORTS                      NAMES
    78330abb3cbc                "/pause"                 5 minutes ago       Up 5 minutes                                   k8s_POD.6079054c_web-controller-6nzpn_default_208f7237-2e65-11e6-98e4-f80f41fc0776_e72a59d6
    8f41e68e0dbb                "/pause"                 5 minutes ago       Up 5 minutes                                   k8s_POD.6079054c_web-controller-uot1s_default_208f587f-2e65-11e6-98e4-    f80f41fc0776_6861905a
    d0d8696f8757        mongo                                             "/ mongo"   8 minutes ago       Up 8 minutes                                   k8s_mongo.a8042bbb_mongo-controller-3b8q5_default_b21552c0-2e64-11e6-98e4-f80f41fc0776_835c7956
    83701f56b225                "/pause"                 9 minutes ago       Up 9 minutes>27017/tcp   k8s_POD.683503f7_mongo-controller-3b8q5_default_b21552c0-2e64-11e6-98e4-f80f41fc0776_a07aaf2b
    bdf64b18dbf0        nginx                                             "nginx -g 'daemon off"   29 minutes ago      Up 29 minutes                                  k8s_nginx.cd4c2839_nginx-198147104-9w444_default_dab5019f-2e61-11e6-98e4-f80f41fc0776_04c0a7dc
    15cfd30b3280                "/pause"                 29 minutes ago      Up 29 minutes                                  k8s_POD.cf58006d_nginx-198147104-9w444_default_dab5019f-2e61-11e6-98e4-f80f41fc0776_aae25ba3
    4409962a7123        "/hyperkube proxy --m"   44 minutes ago      Up 44 minutes                                  stupefied_yonath
    0a8b91c41e68   "/ IP:1"   49 minutes ago      Up 49 minutes                                  k8s_setup.eb843218_k8s-master-
    6a91a6e7620c   "/hyperkube scheduler"   49 minutes ago      Up 49 minutes                                  k8s_scheduler.dbfcc0_k8s-master-
    4ca45bc03c89   "/hyperkube apiserver"   49 minutes ago      Up 49 minutes                                  k8s_apiserver.1082c1e0_k8s-master-
    a5a4cf124d74   "/hyperkube controlle"   49 minutes ago      Up 49 minutes                                  k8s_controller-manager.76914b67_k8s-master-
    3f0c3c342a12               "/usr/local/bin/etcd "   49 minutes ago      Up 49 minutes                                  k8s_etcd.7e452b0b_k8s-etcd-
    3bca02d310dc   "/hyperkube proxy --m"   49 minutes ago      Up 49 minutes                                  k8s_kube-proxy.a1014855_k8s-proxy-
    cf83efe4cf4e                "/pause"                 49 minutes ago      Up 49 minutes                                  k8s_POD.6059dfa2_k8s-master-
    51b02dab5bcd                "/pause"                 49 minutes ago      Up 49 minutes                                  k8s_POD.6059dfa2_k8s-etcd-
    5256fcfbd3d2                "/pause"                 49 minutes ago      Up 49 minutes                                  k8s_POD.6059dfa2_k8s-proxy-
    b41dfb03d56d   "/hyperkube kubelet -"   50 minutes ago      Up 50 minutes                                  kickass_fermat

    The machine has a public IP address, and my goal is to access the demo website from outside. I can access mongo via http://public_IP_address:27017 and curl, because as shown above, mongo has>27017/tcp.However, when I run curl, it is like an infinite loop and eventually it says time out. Why is that?

    Thus, my question is: how to expose web so that it also has a non-empty PORTS field?

    I do not have much knowledge on networking, so any help is greatly appreciated. Thank you very much!

  • Can the Docker driver on OpenStack coexist with libvirt.LibvirtDriver?
  • UnknownHostException in Kubernetes-Container
  • How to pull a single image from any docker repository?
  • Apache not running automatically on docker compose up
  • Change Elastic Beanstalk Configuration To Docker
  • Best practice for connecting to a vpn though docker [closed]
  • One Solution collect form web for “Cannot set up Kubernetes local cluster via Docker”

    If you look at, you’ll see that the service type is LoadBalancer. This is intended to work with cloud providers like AWS and GCE.

    In your case, you need to expose services using NodePorts. Specify type: NodePort and nodePort: 3xxxx (some port greater than 30000) and you can access the service at <NodeIP>:NodePort.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.