docker_practice/kubernetes/quickstart.md

92 lines
4.1 KiB
Go
Raw Normal View History

2015-06-08 10:26:08 +08:00
#
2018-09-08 10:24:38 +08:00
Kubernetes FedoraGoogle GAEAWS Kubernetes Docker
2015-06-08 10:26:08 +08:00
使 Docker Kubernetes
2017-05-24 11:37:58 +08:00
![ Docker Kubernetes](_images/k8s-singlenode-docker.png)
2015-06-08 10:26:08 +08:00
Kubernetes Etcd
## Etcd
2017-12-01 16:32:42 +08:00
```bash
2015-06-08 10:26:08 +08:00
docker run --net=host -d gcr.io/google_containers/etcd:2.0.9 /usr/local/bin/etcd --addr=127.0.0.1:4001 --bind-addr=0.0.0.0:4001 --data-dir=/var/etcd/data
```
##
2017-12-01 16:32:42 +08:00
2015-06-08 10:26:08 +08:00
kubelet
2017-12-01 16:32:42 +08:00
```bash
2015-06-08 10:26:08 +08:00
docker run --net=host -d -v /var/run/docker.sock:/var/run/docker.sock gcr.io/google_containers/hyperkube:v0.17.0 /hyperkube kubelet --api_servers=http://localhost:8080 --v=2 --address=0.0.0.0 --enable_server --hostname_override=127.0.0.1 --config=/etc/kubernetes/manifests
```
##
2017-12-01 16:32:42 +08:00
```bash
2015-06-08 10:26:08 +08:00
docker run -d --net=host --privileged gcr.io/google_containers/hyperkube:v0.17.0 /hyperkube proxy --master=http://127.0.0.1:8080 --v=2
```
##
2017-12-01 16:32:42 +08:00
访 `8080`
```bash
2015-06-08 10:26:08 +08:00
$ curl 127.0.0.1:8080
{
"paths": [
"/api",
"/api/v1beta1",
"/api/v1beta2",
"/api/v1beta3",
"/healthz",
"/healthz/ping",
"/logs/",
"/metrics",
"/static/",
"/swagger-ui/",
"/swaggerapi/",
"/validate",
"/version"
]
}
```
##
2017-12-01 16:32:42 +08:00
Docker
```bash
2015-06-08 10:26:08 +08:00
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ee054db2516c gcr.io/google_containers/hyperkube:v0.17.0 "/hyperkube schedule 2 days ago Up 1 days k8s_scheduler.509f29c9_k8s-master-127.0.0.1_default_9941e5170b4365bd4aa91f122ba0c061_e97037f5
3b0f28de07a2 gcr.io/google_containers/hyperkube:v0.17.0 "/hyperkube apiserve 2 days ago Up 1 days k8s_apiserver.245e44fa_k8s-master-127.0.0.1_default_9941e5170b4365bd4aa91f122ba0c061_6ab5c23d
2eaa44ecdd8e gcr.io/google_containers/hyperkube:v0.17.0 "/hyperkube controll 2 days ago Up 1 days k8s_controller-manager.33f83d43_k8s-master-127.0.0.1_default_9941e5170b4365bd4aa91f122ba0c061_1a60106f
30aa7163cbef gcr.io/google_containers/hyperkube:v0.17.0 "/hyperkube proxy -- 2 days ago Up 1 days jolly_davinci
a2f282976d91 gcr.io/google_containers/pause:0.8.0 "/pause" 2 days ago Up 2 days k8s_POD.e4cc795_k8s-master-127.0.0.1_default_9941e5170b4365bd4aa91f122ba0c061_e8085b1f
c060c52acc36 gcr.io/google_containers/hyperkube:v0.17.0 "/hyperkube kubelet 2 days ago Up 1 days serene_nobel
cc3cd263c581 gcr.io/google_containers/etcd:2.0.9 "/usr/local/bin/etcd 2 days ago Up 1 days happy_turing
```
###
2017-12-01 16:32:42 +08:00
* `apiserver` RESTful
* `scheduler` pod
* `controller-manager` endpoint-controller pod replication-controller pod
2015-06-08 10:26:08 +08:00
###
2017-12-01 16:32:42 +08:00
* `kubelet` agent pod
* `proxy` pod 访
2015-06-08 10:26:08 +08:00
###
2017-12-01 16:32:42 +08:00
* Etcd
2015-06-08 10:26:08 +08:00
* `gcr.io/google_containers/pause:0.8.0` Kubernetes pull