networking - Cannot set up Kubernetes local cluster via Docker -
i followed http://kubernetes.io/docs/getting-started-guides/docker/. here commands literally run:
export k8s_version=$(curl -ss https://storage.googleapis.com/kubernetes-release/release/stable.txt) 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 \ gcr.io/google_containers/hyperkube-${arch}:${k8s_version} \ /hyperkube kubelet \ --containerized \ --hostname-override=127.0.0.1 \ --api-servers=http://localhost:8080 \ --config=/etc/kubernetes/manifests \ --cluster-dns=10.0.0.10 \ --cluster-domain=cluster.local \ --allow-privileged --v=2 curl -ssl "http://storage.googleapis.com/kubernetes-release/release/v1.2.0/bin/linux/amd64/kubectl" > /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 followed https://github.com/kubernetes/kubernetes/tree/release-1.2/examples/nodesjs-mongodb:
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 python flask app, replace image own , args ['export docker=true && cd commandcenter/ && python app.py']
this reult of kubectl services
:
name cluster-ip external-ip port(s) age kubernetes 10.0.0.1 <none> 443/tcp 3d mongo 10.0.0.167 <none> 27017/tcp 14m web 10.0.0.119 80/tcp 6m
reult of kubectl pods
:
name ready status restarts age k8s-etcd-127.0.0.1 1/1 running 0 3d k8s-master-127.0.0.1 4/4 running 0 3d k8s-proxy-127.0.0.1 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 server info 2016-06-09 17:57:49,285 * running on http://0.0.0.0:3000/ (press ctrl+c quit)
result of kubectl nodes
:
name status age 127.0.0.1 ready 3d
result of docker ps
:
container id image command created status ports names 78330abb3cbc gcr.io/google_containers/pause:2.0 "/pause" 5 minutes ago 5 minutes k8s_pod.6079054c_web-controller-6nzpn_default_208f7237-2e65-11e6-98e4-f80f41fc0776_e72a59d6 8f41e68e0dbb gcr.io/google_containers/pause:2.0 "/pause" 5 minutes ago 5 minutes k8s_pod.6079054c_web-controller-uot1s_default_208f587f-2e65-11e6-98e4- f80f41fc0776_6861905a d0d8696f8757 mongo "/entrypoint.sh mongo" 8 minutes ago 8 minutes k8s_mongo.a8042bbb_mongo-controller-3b8q5_default_b21552c0-2e64-11e6-98e4-f80f41fc0776_835c7956 83701f56b225 gcr.io/google_containers/pause:2.0 "/pause" 9 minutes ago 9 minutes 0.0.0.0:27017->27017/tcp k8s_pod.683503f7_mongo-controller-3b8q5_default_b21552c0-2e64-11e6-98e4-f80f41fc0776_a07aaf2b bdf64b18dbf0 nginx "nginx -g 'daemon off" 29 minutes ago 29 minutes k8s_nginx.cd4c2839_nginx-198147104-9w444_default_dab5019f-2e61-11e6-98e4-f80f41fc0776_04c0a7dc 15cfd30b3280 gcr.io/google_containers/pause:2.0 "/pause" 29 minutes ago 29 minutes k8s_pod.cf58006d_nginx-198147104-9w444_default_dab5019f-2e61-11e6-98e4-f80f41fc0776_aae25ba3 4409962a7123 gcr.io/google_containers/hyperkube:v0.21.2 "/hyperkube proxy --m" 44 minutes ago 44 minutes stupefied_yonath 0a8b91c41e68 gcr.io/google_containers/hyperkube-amd64:v1.2.4 "/setup-files.sh ip:1" 49 minutes ago 49 minutes k8s_setup.eb843218_k8s-master-127.0.0.1_default_721118f359852533089009890ac21208_22bec1b0 6a91a6e7620c gcr.io/google_containers/hyperkube-amd64:v1.2.4 "/hyperkube scheduler" 49 minutes ago 49 minutes k8s_scheduler.dbfcc0_k8s-master-127.0.0.1_default_721118f359852533089009890ac21208_feeb19b7 4ca45bc03c89 gcr.io/google_containers/hyperkube-amd64:v1.2.4 "/hyperkube apiserver" 49 minutes ago 49 minutes k8s_apiserver.1082c1e0_k8s-master-127.0.0.1_default_721118f359852533089009890ac21208_16592f39 a5a4cf124d74 gcr.io/google_containers/hyperkube-amd64:v1.2.4 "/hyperkube controlle" 49 minutes ago 49 minutes k8s_controller-manager.76914b67_k8s-master-127.0.0.1_default_721118f359852533089009890ac21208_d2dffc43 3f0c3c342a12 gcr.io/google_containers/etcd:2.2.1 "/usr/local/bin/etcd " 49 minutes ago 49 minutes k8s_etcd.7e452b0b_k8s-etcd-127.0.0.1_default_1df6a8b4d6e129d5ed8840e370203c11_82b244e9 3bca02d310dc gcr.io/google_containers/hyperkube-amd64:v1.2.4 "/hyperkube proxy --m" 49 minutes ago 49 minutes k8s_kube-proxy.a1014855_k8s-proxy-127.0.0.1_default_0cda4a663a246109121ac68b3c7e82b7_c610ef5f cf83efe4cf4e gcr.io/google_containers/pause:2.0 "/pause" 49 minutes ago 49 minutes k8s_pod.6059dfa2_k8s-master-127.0.0.1_default_721118f359852533089009890ac21208_2864939a 51b02dab5bcd gcr.io/google_containers/pause:2.0 "/pause" 49 minutes ago 49 minutes k8s_pod.6059dfa2_k8s-etcd-127.0.0.1_default_1df6a8b4d6e129d5ed8840e370203c11_9cf2fc4d 5256fcfbd3d2 gcr.io/google_containers/pause:2.0 "/pause" 49 minutes ago 49 minutes k8s_pod.6059dfa2_k8s-proxy-127.0.0.1_default_0cda4a663a246109121ac68b3c7e82b7_86be1d4f b41dfb03d56d gcr.io/google_containers/hyperkube-amd64:v1.2.4 "/hyperkube kubelet -" 50 minutes ago 50 minutes kickass_fermat
the machine has public ip address, , goal access demo website outside. can access mongo via http://public_ip_address:27017
, curl 10.0.0.167:27017
, because shown above, mongo
has 0.0.0.0:27017->27017/tcp
.however, when run curl 10.0.0.119:3000
, infinite loop , says time out. why that?
thus, question is: how expose web
has non-empty ports
field?
i not have knowledge on networking, appreciated. thank much!
if @ https://github.com/kubernetes/kubernetes/blob/release-1.2/examples/nodesjs-mongodb/web-service.yaml, you'll see service type loadbalancer
. intended work cloud providers aws , gce.
in case, need expose services using nodeports. specify type: nodeport
, nodeport: 3xxxx
(some port greater 30000) , can access service @ <nodeip>:nodeport
.
Comments
Post a Comment