jopen 5年前

Kubernetes 是来自 Google 云平台的开源容器集群管理系统。基于 Docker 构建一个容器的调度服务。该系统可以自动在一个容器集群中选择一个工作容器供使用。其核心概念是 Container Pod。详细的设计思路请参考这里

Running a container (simple version)

Once you have your instances up and running, the script sets up your Go workspace and builds the Go components.

The script spins up two containers, running Nginx and with port 80 mapped to 8080:

cd kubernetes  hack/  cluster/ -p 8080:80 run dockerfile/nginx 2 myNginx

To stop the containers:

cluster/ stop myNginx

To delete the containers:

cluster/ rm myNginx

Running a container (more complete version)

Assuming you've run hack/ and hack/

cd kubernetes  cluster/ -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/