mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
Merge pull request #16440 from thockin/docker-run-docs
Auto commit by PR queue bot
This commit is contained in:
commit
fc5066aabf
@ -33,7 +33,9 @@ Documentation for other releases can be found at
|
|||||||
|
|
||||||
## Installing a Kubernetes Master Node via Docker
|
## Installing a Kubernetes Master Node via Docker
|
||||||
|
|
||||||
We'll begin by setting up the master node. For the purposes of illustration, we'll assume that the IP of this machine is `${MASTER_IP}`
|
We'll begin by setting up the master node. For the purposes of illustration, we'll assume that the IP of this machine
|
||||||
|
is `${MASTER_IP}`. We'll need to run several versioned Kubernetes components, so we'll assume that the version we want
|
||||||
|
to run is `${K8S_VERSION}`, which should hold a value such as "1.0.7".
|
||||||
|
|
||||||
There are two main phases to installing the master:
|
There are two main phases to installing the master:
|
||||||
* [Setting up `flanneld` and `etcd`](#setting-up-flanneld-and-etcd)
|
* [Setting up `flanneld` and `etcd`](#setting-up-flanneld-and-etcd)
|
||||||
@ -44,7 +46,7 @@ There are two main phases to installing the master:
|
|||||||
|
|
||||||
_Note_:
|
_Note_:
|
||||||
There is a [bug](https://github.com/docker/docker/issues/14106) in Docker 1.7.0 that prevents this from working correctly.
|
There is a [bug](https://github.com/docker/docker/issues/14106) in Docker 1.7.0 that prevents this from working correctly.
|
||||||
Please install Docker 1.6.2 or Docker 1.7.1.
|
Please install Docker 1.6.2 or Docker 1.7.1 or Docker 1.8.3.
|
||||||
|
|
||||||
### Setup Docker-Bootstrap
|
### Setup Docker-Bootstrap
|
||||||
|
|
||||||
@ -171,7 +173,7 @@ sudo docker run \
|
|||||||
--privileged=true \
|
--privileged=true \
|
||||||
--pid=host \
|
--pid=host \
|
||||||
-d \
|
-d \
|
||||||
gcr.io/google_containers/hyperkube:v1.0.1 /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-multi --cluster-dns=10.0.0.10 --cluster-domain=cluster.local
|
gcr.io/google_containers/hyperkube:v${K8S_VERSION} /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-multi --cluster-dns=10.0.0.10 --cluster-domain=cluster.local
|
||||||
```
|
```
|
||||||
|
|
||||||
> Note that `--cluster-dns` and `--cluster-domain` is used to deploy dns, feel free to discard them if dns is not needed.
|
> Note that `--cluster-dns` and `--cluster-domain` is used to deploy dns, feel free to discard them if dns is not needed.
|
||||||
@ -179,24 +181,40 @@ sudo docker run \
|
|||||||
### Also run the service proxy
|
### Also run the service proxy
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo docker run -d --net=host --privileged gcr.io/google_containers/hyperkube:v1.0.1 /hyperkube proxy --master=http://127.0.0.1:8080 --v=2
|
sudo docker run -d --net=host --privileged gcr.io/google_containers/hyperkube:v${K8S_VERSION} /hyperkube proxy --master=http://127.0.0.1:8080 --v=2
|
||||||
```
|
```
|
||||||
|
|
||||||
### Test it out
|
### Test it out
|
||||||
|
|
||||||
At this point, you should have a functioning 1-node cluster. Let's test it out!
|
At this point, you should have a functioning 1-node cluster. Let's test it out!
|
||||||
|
|
||||||
Download the kubectl binary and make it available by editing your PATH ENV.
|
Download the kubectl binary for `${K8S_VERSION}` (look at the URL in the following links) and make it available by editing your PATH environment variable.
|
||||||
([OS X](http://storage.googleapis.com/kubernetes-release/release/v1.0.1/bin/darwin/amd64/kubectl))
|
([OS X](http://storage.googleapis.com/kubernetes-release/release/v1.0.7/bin/darwin/amd64/kubectl))
|
||||||
([linux](http://storage.googleapis.com/kubernetes-release/release/v1.0.1/bin/linux/amd64/kubectl))
|
([linux](http://storage.googleapis.com/kubernetes-release/release/v1.0.7/bin/linux/amd64/kubectl))
|
||||||
|
|
||||||
List the nodes
|
For example, OS X:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ wget http://storage.googleapis.com/kubernetes-release/release/v${K8S_VERSION}/bin/darwin/amd64/kubectl
|
||||||
|
$ chmod 755 kubectl
|
||||||
|
$ PATH=$PATH:`pwd`
|
||||||
|
```
|
||||||
|
|
||||||
|
Linux:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ wget http://storage.googleapis.com/kubernetes-release/release/v${K8S_VERSION}/bin/linux/amd64/kubectl
|
||||||
|
$ chmod 755 kubectl
|
||||||
|
$ PATH=$PATH:`pwd`
|
||||||
|
```
|
||||||
|
|
||||||
|
Now you can list the nodes:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
kubectl get nodes
|
kubectl get nodes
|
||||||
```
|
```
|
||||||
|
|
||||||
This should print:
|
This should print something like:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
NAME LABELS STATUS
|
NAME LABELS STATUS
|
||||||
|
@ -27,7 +27,7 @@ fi
|
|||||||
|
|
||||||
# Make sure k8s version env is properly set
|
# Make sure k8s version env is properly set
|
||||||
if [ -z ${K8S_VERSION} ]; then
|
if [ -z ${K8S_VERSION} ]; then
|
||||||
K8S_VERSION="1.0.3"
|
K8S_VERSION="1.0.7"
|
||||||
echo "K8S_VERSION is not set, using default: ${K8S_VERSION}"
|
echo "K8S_VERSION is not set, using default: ${K8S_VERSION}"
|
||||||
else
|
else
|
||||||
echo "k8s version is set to: ${K8S_VERSION}"
|
echo "k8s version is set to: ${K8S_VERSION}"
|
||||||
|
@ -37,7 +37,8 @@ Documentation for other releases can be found at
|
|||||||
|
|
||||||
These instructions are very similar to the master set-up above, but they are duplicated for clarity.
|
These instructions are very similar to the master set-up above, but they are duplicated for clarity.
|
||||||
You need to repeat these instructions for each node you want to join the cluster.
|
You need to repeat these instructions for each node you want to join the cluster.
|
||||||
We will assume that the IP address of this node is `${NODE_IP}` and you have the IP address of the master in `${MASTER_IP}` that you created in the [master instructions](master.md).
|
We will assume that the IP address of this node is `${NODE_IP}` and you have the IP address of the master in `${MASTER_IP}` that you created in the [master instructions](master.md). We'll need to run several versioned Kubernetes components, so we'll assume that the version we want
|
||||||
|
to run is `${K8S_VERSION}`, which should hold a value such as "1.0.7".
|
||||||
|
|
||||||
For each worker node, there are three steps:
|
For each worker node, there are three steps:
|
||||||
* [Set up `flanneld` on the worker node](#set-up-flanneld-on-the-worker-node)
|
* [Set up `flanneld` on the worker node](#set-up-flanneld-on-the-worker-node)
|
||||||
@ -50,7 +51,7 @@ As before, the Flannel daemon is going to provide network connectivity.
|
|||||||
|
|
||||||
_Note_:
|
_Note_:
|
||||||
There is a [bug](https://github.com/docker/docker/issues/14106) in Docker 1.7.0 that prevents this from working correctly.
|
There is a [bug](https://github.com/docker/docker/issues/14106) in Docker 1.7.0 that prevents this from working correctly.
|
||||||
Please install Docker 1.6.2 or wait for Docker 1.7.1.
|
Please install Docker 1.6.2 or Docker 1.7.1 or Docker 1.8.3.
|
||||||
|
|
||||||
|
|
||||||
#### Set up a bootstrap docker
|
#### Set up a bootstrap docker
|
||||||
@ -157,7 +158,7 @@ sudo docker run \
|
|||||||
--privileged=true \
|
--privileged=true \
|
||||||
--pid=host \
|
--pid=host \
|
||||||
-d \
|
-d \
|
||||||
gcr.io/google_containers/hyperkube:v1.0.1 /hyperkube kubelet --api-servers=http://${MASTER_IP}:8080 --v=2 --address=0.0.0.0 --enable-server --hostname-override=$(hostname -i) --cluster-dns=10.0.0.10 --cluster-domain=cluster.local
|
gcr.io/google_containers/hyperkube:v${K8S_VERSION} /hyperkube kubelet --api-servers=http://${MASTER_IP}:8080 --v=2 --address=0.0.0.0 --enable-server --hostname-override=$(hostname -i) --cluster-dns=10.0.0.10 --cluster-domain=cluster.local
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Run the service proxy
|
#### Run the service proxy
|
||||||
@ -165,7 +166,7 @@ sudo docker run \
|
|||||||
The service proxy provides load-balancing between groups of containers defined by Kubernetes `Services`
|
The service proxy provides load-balancing between groups of containers defined by Kubernetes `Services`
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo docker run -d --net=host --privileged gcr.io/google_containers/hyperkube:v1.0.1 /hyperkube proxy --master=http://${MASTER_IP}:8080 --v=2
|
sudo docker run -d --net=host --privileged gcr.io/google_containers/hyperkube:v${K8S_VERSION} /hyperkube proxy --master=http://${MASTER_IP}:8080 --v=2
|
||||||
```
|
```
|
||||||
|
|
||||||
### Next steps
|
### Next steps
|
||||||
|
@ -27,7 +27,7 @@ fi
|
|||||||
|
|
||||||
# Make sure k8s version env is properly set
|
# Make sure k8s version env is properly set
|
||||||
if [ -z ${K8S_VERSION} ]; then
|
if [ -z ${K8S_VERSION} ]; then
|
||||||
K8S_VERSION="1.0.3"
|
K8S_VERSION="1.0.7"
|
||||||
echo "K8S_VERSION is not set, using default: ${K8S_VERSION}"
|
echo "K8S_VERSION is not set, using default: ${K8S_VERSION}"
|
||||||
else
|
else
|
||||||
echo "k8s version is set to: ${K8S_VERSION}"
|
echo "k8s version is set to: ${K8S_VERSION}"
|
||||||
|
@ -83,6 +83,9 @@ parameters as follows:
|
|||||||
swapaccount=1
|
swapaccount=1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
4. Decide what Kubernetes version to use. Set the `${K8S_VERSION}` variable to
|
||||||
|
a value such as "1.0.7".
|
||||||
|
|
||||||
### Step One: Run etcd
|
### Step One: Run etcd
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@ -103,7 +106,7 @@ docker run \
|
|||||||
--pid=host \
|
--pid=host \
|
||||||
--privileged=true \
|
--privileged=true \
|
||||||
-d \
|
-d \
|
||||||
gcr.io/google_containers/hyperkube:v1.0.6 \
|
gcr.io/google_containers/hyperkube:v${K8S_VERSION} \
|
||||||
/hyperkube kubelet --containerized --hostname-override="127.0.0.1" --address="0.0.0.0" --api-servers=http://localhost:8080 --config=/etc/kubernetes/manifests
|
/hyperkube kubelet --containerized --hostname-override="127.0.0.1" --address="0.0.0.0" --api-servers=http://localhost:8080 --config=/etc/kubernetes/manifests
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -112,15 +115,33 @@ This actually runs the kubelet, which in turn runs a [pod](../user-guide/pods.md
|
|||||||
### Step Three: Run the service proxy
|
### Step Three: Run the service proxy
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker run -d --net=host --privileged gcr.io/google_containers/hyperkube:v1.0.6 /hyperkube proxy --master=http://127.0.0.1:8080 --v=2
|
docker run -d --net=host --privileged gcr.io/google_containers/hyperkube:v${K8S_VERSION} /hyperkube proxy --master=http://127.0.0.1:8080 --v=2
|
||||||
```
|
```
|
||||||
|
|
||||||
### Test it out
|
### Test it out
|
||||||
|
|
||||||
At this point you should have a running Kubernetes cluster. You can test this by downloading the kubectl
|
At this point you should have a running Kubernetes cluster. You can test this
|
||||||
binary
|
by downloading the kubectl binary for `${K8S_VERSION}` (look at the URL in the
|
||||||
([OS X](https://storage.googleapis.com/kubernetes-release/release/v1.0.1/bin/darwin/amd64/kubectl))
|
following links) and make it available by editing your PATH environment
|
||||||
([linux](https://storage.googleapis.com/kubernetes-release/release/v1.0.1/bin/linux/amd64/kubectl))
|
variable.
|
||||||
|
([OS X](http://storage.googleapis.com/kubernetes-release/release/v1.0.7/bin/darwin/amd64/kubectl))
|
||||||
|
([linux](http://storage.googleapis.com/kubernetes-release/release/v1.0.7/bin/linux/amd64/kubectl))
|
||||||
|
|
||||||
|
For example, OS X:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ wget http://storage.googleapis.com/kubernetes-release/release/v${K8S_VERSION}/bin/darwin/amd64/kubectl
|
||||||
|
$ chmod 755 kubectl
|
||||||
|
$ PATH=$PATH:`pwd`
|
||||||
|
```
|
||||||
|
|
||||||
|
Linux:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ wget http://storage.googleapis.com/kubernetes-release/release/v${K8S_VERSION}/bin/linux/amd64/kubectl
|
||||||
|
$ chmod 755 kubectl
|
||||||
|
$ PATH=$PATH:`pwd`
|
||||||
|
```
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user