Various manual fixes for syntax highlighting and lists; much prettier docs ensue.
This commit is contained in:
@@ -13,7 +13,7 @@ First of all, download the template dns rc and svc file from
|
||||
|
||||
Then you need to set `DNS_REPLICAS` , `DNS_DOMAIN` , `DNS_SERVER_IP` , `KUBE_SERVER` ENV.
|
||||
|
||||
```
|
||||
```shell
|
||||
$ export DNS_REPLICAS=1
|
||||
|
||||
$ export DNS_DOMAIN=cluster.local # specify in startup parameter `--cluster-domain` for containerized kubelet
|
||||
@@ -21,25 +21,25 @@ $ export DNS_DOMAIN=cluster.local # specify in startup parameter `--cluster-doma
|
||||
$ export DNS_SERVER_IP=10.0.0.10 # specify in startup parameter `--cluster-dns` for containerized kubelet
|
||||
|
||||
$ export KUBE_SERVER=10.10.103.250 # your master server ip, you may change it
|
||||
|
||||
```
|
||||
|
||||
### Replace the corresponding value in the template.
|
||||
|
||||
```
|
||||
```shell
|
||||
$ sed -e "s/{{ pillar\['dns_replicas'\] }}/${DNS_REPLICAS}/g;s/{{ pillar\['dns_domain'\] }}/${DNS_DOMAIN}/g;s/{kube_server_url}/${KUBE_SERVER}/g;" skydns-rc.yaml.in > ./skydns-rc.yaml
|
||||
|
||||
$ sed -e "s/{{ pillar\['dns_server'\] }}/${DNS_SERVER_IP}/g" skydns-svc.yaml.in > ./skydns-svc.yaml
|
||||
|
||||
```
|
||||
|
||||
### Use `kubectl` to create skydns rc and service
|
||||
|
||||
|
||||
```
|
||||
```shell
|
||||
$ kubectl -s "$KUBE_SERVER:8080" --namespace=kube-system create -f ./skydns-rc.yaml
|
||||
|
||||
$ kubectl -s "$KUBE_SERVER:8080" --namespace=kube-system create -f ./skydns-svc.yaml
|
||||
|
||||
```
|
||||
|
||||
### Test if DNS works
|
||||
|
||||
Follow [this link](https://releases.k8s.io/release-1.1/cluster/addons/dns#how-do-i-test-if-it-is-working) to check it out.
|
||||
|
||||
@@ -24,8 +24,8 @@ Run:
|
||||
|
||||
```shell
|
||||
sudo sh -c 'docker -d -H unix:///var/run/docker-bootstrap.sock -p /var/run/docker-bootstrap.pid --iptables=false --ip-masq=false --bridge=none --graph=/var/lib/docker-bootstrap 2> /var/log/docker-bootstrap.log 1> /dev/null &'
|
||||
|
||||
```
|
||||
|
||||
_Important Note_:
|
||||
If you are running this on a long running system, rather than experimenting, you should run the bootstrap Docker instance under something like SysV init, upstart or systemd so that it is restarted
|
||||
across reboots and failures.
|
||||
@@ -37,14 +37,14 @@ Run:
|
||||
|
||||
```shell
|
||||
sudo docker -H unix:///var/run/docker-bootstrap.sock run --net=host -d gcr.io/google_containers/etcd:2.0.12 /usr/local/bin/etcd --addr=127.0.0.1:4001 --bind-addr=0.0.0.0:4001 --data-dir=/var/etcd/data
|
||||
|
||||
```
|
||||
|
||||
Next, you need to set a CIDR range for flannel. This CIDR should be chosen to be non-overlapping with any existing network you are using:
|
||||
|
||||
```shell
|
||||
sudo docker -H unix:///var/run/docker-bootstrap.sock run --net=host gcr.io/google_containers/etcd:2.0.12 etcdctl set /coreos.com/network/config '{ "Network": "10.1.0.0/16" }'
|
||||
|
||||
```
|
||||
|
||||
### Set up Flannel on the master node
|
||||
|
||||
Flannel is a network abstraction layer build by CoreOS, we will use it to provide simplified networking between our Pods of containers.
|
||||
@@ -59,14 +59,14 @@ Turning down Docker is system dependent, it may be:
|
||||
|
||||
```shell
|
||||
sudo /etc/init.d/docker stop
|
||||
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```shell
|
||||
sudo systemctl stop docker
|
||||
|
||||
```
|
||||
|
||||
or it may be something else.
|
||||
|
||||
#### Run flannel
|
||||
@@ -75,16 +75,16 @@ Now run flanneld itself:
|
||||
|
||||
```shell
|
||||
sudo docker -H unix:///var/run/docker-bootstrap.sock run -d --net=host --privileged -v /dev/net:/dev/net quay.io/coreos/flannel:0.5.0
|
||||
|
||||
```
|
||||
|
||||
The previous command should have printed a really long hash, copy this hash.
|
||||
|
||||
Now get the subnet settings from flannel:
|
||||
|
||||
```shell
|
||||
sudo docker -H unix:///var/run/docker-bootstrap.sock exec <really-long-hash-from-above-here> cat /run/flannel/subnet.env
|
||||
|
||||
```
|
||||
|
||||
#### Edit the docker configuration
|
||||
|
||||
You now need to edit the docker configuration to activate new flags. Again, this is system specific.
|
||||
@@ -95,8 +95,8 @@ Regardless, you need to add the following to the docker command line:
|
||||
|
||||
```shell
|
||||
--bip=${FLANNEL_SUBNET} --mtu=${FLANNEL_MTU}
|
||||
|
||||
```
|
||||
|
||||
#### Remove the existing Docker bridge
|
||||
|
||||
Docker creates a bridge named `docker0` by default. You need to remove this:
|
||||
@@ -104,8 +104,8 @@ Docker creates a bridge named `docker0` by default. You need to remove this:
|
||||
```shell
|
||||
sudo /sbin/ifconfig docker0 down
|
||||
sudo brctl delbr docker0
|
||||
|
||||
```
|
||||
|
||||
You may need to install the `bridge-utils` package for the `brctl` binary.
|
||||
|
||||
#### Restart Docker
|
||||
@@ -114,14 +114,14 @@ Again this is system dependent, it may be:
|
||||
|
||||
```shell
|
||||
sudo /etc/init.d/docker start
|
||||
|
||||
```
|
||||
|
||||
it may be:
|
||||
|
||||
```shell
|
||||
systemctl start docker
|
||||
|
||||
```
|
||||
|
||||
## Starting the Kubernetes Master
|
||||
|
||||
Ok, now that your networking is set up, you can startup Kubernetes, this is the same as the single-node case, we will use the "main" instance of the Docker daemon for the Kubernetes components.
|
||||
@@ -139,16 +139,16 @@ sudo docker run \
|
||||
--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
|
||||
|
||||
```
|
||||
|
||||
> Note that `--cluster-dns` and `--cluster-domain` is used to deploy dns, feel free to discard them if dns is not needed.
|
||||
|
||||
### Also run the service proxy
|
||||
|
||||
```shell
|
||||
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
|
||||
|
||||
```
|
||||
|
||||
### Test it out
|
||||
|
||||
At this point, you should have a functioning 1-node cluster. Let's test it out!
|
||||
@@ -161,22 +161,19 @@ List the nodes
|
||||
|
||||
```shell
|
||||
kubectl get nodes
|
||||
|
||||
```
|
||||
|
||||
This should print:
|
||||
|
||||
```shell
|
||||
NAME LABELS STATUS
|
||||
127.0.0.1 kubernetes.io/hostname=127.0.0.1 Ready
|
||||
|
||||
```
|
||||
|
||||
If the status of the node is `NotReady` or `Unknown` please check that all of the containers you created are successfully running.
|
||||
If all else fails, ask questions on [Slack](../../troubleshooting.html#slack).
|
||||
|
||||
|
||||
### Next steps
|
||||
|
||||
Move on to [adding one or more workers](worker) or [deploy a dns](deployDNS)
|
||||
|
||||
|
||||
|
||||
Move on to [adding one or more workers](worker) or [deploy a dns](deployDNS)
|
||||
@@ -5,50 +5,50 @@ To validate that your node(s) have been added, run:
|
||||
|
||||
```shell
|
||||
kubectl get nodes
|
||||
|
||||
```
|
||||
|
||||
That should show something like:
|
||||
|
||||
```shell
|
||||
NAME LABELS STATUS
|
||||
10.240.99.26 kubernetes.io/hostname=10.240.99.26 Ready
|
||||
127.0.0.1 kubernetes.io/hostname=127.0.0.1 Ready
|
||||
|
||||
```
|
||||
|
||||
If the status of any node is `Unknown` or `NotReady` your cluster is broken, double check that all containers are running properly, and if all else fails, contact us on [Slack](../../troubleshooting.html#slack).
|
||||
|
||||
### Run an application
|
||||
|
||||
```shell
|
||||
kubectl -s http://localhost:8080 run nginx --image=nginx --port=80
|
||||
|
||||
```
|
||||
|
||||
now run `docker ps` you should see nginx running. You may need to wait a few minutes for the image to get pulled.
|
||||
|
||||
### Expose it as a service
|
||||
|
||||
```shell
|
||||
kubectl expose rc nginx --port=80
|
||||
|
||||
```
|
||||
Run the following command to obtain the IP of this service we just created. There are two IPs, the first one is internal (CLUSTER_IP), and the second one is the external load-balanced IP.
|
||||
|
||||
Run the following command to obtain the IP of this service we just created. There are two IPs, the first one is internal (`CLUSTER_IP`), and the second one is the external load-balanced IP.
|
||||
|
||||
```shell
|
||||
kubectl get svc nginx
|
||||
|
||||
```
|
||||
|
||||
Alternatively, you can obtain only the first IP (CLUSTER_IP) by running:
|
||||
|
||||
```shell
|
||||
kubectl get svc nginx --template={{.spec.clusterIP}}
|
||||
|
||||
{% raw %}kubectl get svc nginx --template={{.spec.clusterIP}}{% endraw %}
|
||||
```
|
||||
|
||||
Hit the webserver with the first IP (CLUSTER_IP):
|
||||
|
||||
```shell
|
||||
curl <insert-cluster-ip-here>
|
||||
|
||||
```
|
||||
|
||||
Note that you will need run this curl command on your boot2docker VM if you are running on OS X.
|
||||
|
||||
### Scaling
|
||||
@@ -57,15 +57,12 @@ Now try to scale up the nginx you created before:
|
||||
|
||||
```shell
|
||||
kubectl scale rc nginx --replicas=3
|
||||
|
||||
```
|
||||
|
||||
And list the pods
|
||||
|
||||
```shell
|
||||
kubectl get pods
|
||||
|
||||
```
|
||||
You should see pods landing on the newly added machine.
|
||||
|
||||
|
||||
|
||||
You should see pods landing on the newly added machine.
|
||||
@@ -6,9 +6,10 @@ 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).
|
||||
|
||||
For each worker node, there are three steps:
|
||||
* [Set up `flanneld` on the worker node](#set-up-flanneld-on-the-worker-node)
|
||||
* [Start Kubernetes on the worker node](#start-kubernetes-on-the-worker-node)
|
||||
* [Add the worker to the cluster](#add-the-node-to-the-cluster)
|
||||
|
||||
* [Set up `flanneld` on the worker node](#set-up-flanneld-on-the-worker-node)
|
||||
* [Start Kubernetes on the worker node](#start-kubernetes-on-the-worker-node)
|
||||
* [Add the worker to the cluster](#add-the-node-to-the-cluster)
|
||||
|
||||
### Set up Flanneld on the worker node
|
||||
|
||||
@@ -27,8 +28,8 @@ Run:
|
||||
|
||||
```shell
|
||||
sudo sh -c 'docker -d -H unix:///var/run/docker-bootstrap.sock -p /var/run/docker-bootstrap.pid --iptables=false --ip-masq=false --bridge=none --graph=/var/lib/docker-bootstrap 2> /var/log/docker-bootstrap.log 1> /dev/null &'
|
||||
|
||||
```
|
||||
|
||||
_Important Note_:
|
||||
If you are running this on a long running system, rather than experimenting, you should run the bootstrap Docker instance under something like SysV init, upstart or systemd so that it is restarted
|
||||
across reboots and failures.
|
||||
@@ -41,14 +42,14 @@ Turning down Docker is system dependent, it may be:
|
||||
|
||||
```shell
|
||||
sudo /etc/init.d/docker stop
|
||||
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```shell
|
||||
sudo systemctl stop docker
|
||||
|
||||
```
|
||||
|
||||
or it may be something else.
|
||||
|
||||
#### Run flannel
|
||||
@@ -57,16 +58,16 @@ Now run flanneld itself, this call is slightly different from the above, since w
|
||||
|
||||
```shell
|
||||
sudo docker -H unix:///var/run/docker-bootstrap.sock run -d --net=host --privileged -v /dev/net:/dev/net quay.io/coreos/flannel:0.5.0 /opt/bin/flanneld --etcd-endpoints=http://${MASTER_IP}:4001
|
||||
|
||||
```
|
||||
|
||||
The previous command should have printed a really long hash, copy this hash.
|
||||
|
||||
Now get the subnet settings from flannel:
|
||||
|
||||
```shell
|
||||
sudo docker -H unix:///var/run/docker-bootstrap.sock exec <really-long-hash-from-above-here> cat /run/flannel/subnet.env
|
||||
|
||||
```
|
||||
|
||||
#### Edit the docker configuration
|
||||
|
||||
You now need to edit the docker configuration to activate new flags. Again, this is system specific.
|
||||
@@ -77,8 +78,8 @@ Regardless, you need to add the following to the docker command line:
|
||||
|
||||
```shell
|
||||
--bip=${FLANNEL_SUBNET} --mtu=${FLANNEL_MTU}
|
||||
|
||||
```
|
||||
|
||||
#### Remove the existing Docker bridge
|
||||
|
||||
Docker creates a bridge named `docker0` by default. You need to remove this:
|
||||
@@ -86,8 +87,8 @@ Docker creates a bridge named `docker0` by default. You need to remove this:
|
||||
```shell
|
||||
sudo /sbin/ifconfig docker0 down
|
||||
sudo brctl delbr docker0
|
||||
|
||||
```
|
||||
|
||||
You may need to install the `bridge-utils` package for the `brctl` binary.
|
||||
|
||||
#### Restart Docker
|
||||
@@ -96,14 +97,14 @@ Again this is system dependent, it may be:
|
||||
|
||||
```shell
|
||||
sudo /etc/init.d/docker start
|
||||
|
||||
```
|
||||
|
||||
it may be:
|
||||
|
||||
```shell
|
||||
systemctl start docker
|
||||
|
||||
```
|
||||
|
||||
### Start Kubernetes on the worker node
|
||||
|
||||
#### Run the kubelet
|
||||
@@ -123,19 +124,16 @@ sudo docker run \
|
||||
--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
|
||||
|
||||
```
|
||||
|
||||
#### Run the service proxy
|
||||
|
||||
The service proxy provides load-balancing between groups of containers defined by Kubernetes `Services`
|
||||
|
||||
```shell
|
||||
sudo docker run -d --net=host --privileged gcr.io/google_containers/hyperkube:v1.0.1 /hyperkube proxy --master=http://${MASTER_IP}:8080 --v=2
|
||||
|
||||
```
|
||||
|
||||
### Next steps
|
||||
|
||||
Move on to [testing your cluster](testing) or [add another node](#adding-a-kubernetes-worker-node-via-docker)
|
||||
|
||||
|
||||
|
||||
Move on to [testing your cluster](testing) or add another node](#).
|
||||
Reference in New Issue
Block a user