mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
Update docs for running under docker
Make them a bit more version safe.
This commit is contained in:
parent
a0ef44b712
commit
faa5c5885a
@ -33,7 +33,9 @@ Documentation for other releases can be found at
|
||||
|
||||
## 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:
|
||||
* [Setting up `flanneld` and `etcd`](#setting-up-flanneld-and-etcd)
|
||||
@ -44,7 +46,7 @@ There are two main phases to installing the master:
|
||||
|
||||
_Note_:
|
||||
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
|
||||
|
||||
@ -171,7 +173,7 @@ sudo docker run \
|
||||
--privileged=true \
|
||||
--pid=host \
|
||||
-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.
|
||||
@ -179,24 +181,40 @@ sudo docker run \
|
||||
### Also run the service proxy
|
||||
|
||||
```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
|
||||
|
||||
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.
|
||||
([OS X](http://storage.googleapis.com/kubernetes-release/release/v1.0.1/bin/darwin/amd64/kubectl))
|
||||
([linux](http://storage.googleapis.com/kubernetes-release/release/v1.0.1/bin/linux/amd64/kubectl))
|
||||
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.7/bin/darwin/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
|
||||
kubectl get nodes
|
||||
```
|
||||
|
||||
This should print:
|
||||
This should print something like:
|
||||
|
||||
```console
|
||||
NAME LABELS STATUS
|
||||
|
@ -27,7 +27,7 @@ fi
|
||||
|
||||
# Make sure k8s version env is properly set
|
||||
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}"
|
||||
else
|
||||
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.
|
||||
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:
|
||||
* [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_:
|
||||
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
|
||||
@ -157,7 +158,7 @@ sudo docker run \
|
||||
--privileged=true \
|
||||
--pid=host \
|
||||
-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
|
||||
@ -165,7 +166,7 @@ sudo docker run \
|
||||
The service proxy provides load-balancing between groups of containers defined by Kubernetes `Services`
|
||||
|
||||
```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
|
||||
|
@ -27,7 +27,7 @@ fi
|
||||
|
||||
# Make sure k8s version env is properly set
|
||||
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}"
|
||||
else
|
||||
echo "k8s version is set to: ${K8S_VERSION}"
|
||||
|
@ -83,6 +83,9 @@ parameters as follows:
|
||||
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
|
||||
|
||||
```sh
|
||||
@ -103,7 +106,7 @@ docker run \
|
||||
--pid=host \
|
||||
--privileged=true \
|
||||
-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
|
||||
```
|
||||
|
||||
@ -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
|
||||
|
||||
```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
|
||||
|
||||
At this point you should have a running Kubernetes cluster. You can test this by downloading the kubectl
|
||||
binary
|
||||
([OS X](https://storage.googleapis.com/kubernetes-release/release/v1.0.1/bin/darwin/amd64/kubectl))
|
||||
([linux](https://storage.googleapis.com/kubernetes-release/release/v1.0.1/bin/linux/amd64/kubectl))
|
||||
At this point you should have a running Kubernetes cluster. You can test this
|
||||
by downloading 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.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>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user