Google开源的容器集群管理系统:Kubernetes
jopen
10年前
Kubernetes 是来自 Google 云平台的开源容器集群管理系统。基于 Docker 构建一个容器的调度服务。该系统可以自动在一个容器集群中选择一个工作容器供使用。其核心概念是 Container Pod。详细的设计思路请参考这里。
Running a container (simple version)
Once you have your instances up and running, the build-go.sh
script sets up your Go workspace and builds the Go components.
The cloudcfg.sh
script spins up two containers, running Nginx and with port 80 mapped to 8080:
cd kubernetes hack/build-go.sh cluster/cloudcfg.sh -p 8080:80 run dockerfile/nginx 2 myNginx
To stop the containers:
cluster/cloudcfg.sh stop myNginx
To delete the containers:
cluster/cloudcfg.sh rm myNginx
Running a container (more complete version)
Assuming you've run hack/dev-build-and-up.sh
and hack/build-go.sh
:
cd kubernetes cluster/cloudcfg.sh -c api/examples/pod.json create /pods
Where pod.json contains something like:
{ "ID": "nginx", "desiredState": { "image": "dockerfile/nginx", "networkPorts": [{ "containerPort": 80, "hostPort": 8080 }] }, "labels": { "name": "foo" } }
Look in api/examples/
for more examples
Tearing down the cluster
cd kubernetes cluster/kube-down.sh