Various searches and replaces. Movement of TOC association to recursive loop function tocsearch.html
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
---
|
||||
title: "Deploy DNS"
|
||||
---
|
||||
|
||||
|
||||
## Deploy DNS
|
||||
|
||||
### Get the template file
|
||||
|
||||
First of all, download the template dns rc and svc file from
|
||||
@@ -18,7 +14,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.
|
||||
|
||||
```
|
||||
{% raw %}
|
||||
|
||||
$ export DNS_REPLICAS=1
|
||||
|
||||
$ export DNS_DOMAIN=cluster.local # specify in startup parameter `--cluster-domain` for containerized kubelet
|
||||
@@ -26,28 +22,28 @@ $ 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
|
||||
{% endraw %}
|
||||
|
||||
```
|
||||
|
||||
### Replace the corresponding value in the template.
|
||||
|
||||
```
|
||||
{% raw %}
|
||||
|
||||
$ 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
|
||||
{% endraw %}
|
||||
|
||||
```
|
||||
|
||||
### Use `kubectl` to create skydns rc and service
|
||||
|
||||
|
||||
```
|
||||
{% raw %}
|
||||
|
||||
$ 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
|
||||
{% endraw %}
|
||||
|
||||
```
|
||||
|
||||
### Test if DNS works
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
---
|
||||
title: "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}`
|
||||
|
||||
There are two main phases to installing the master:
|
||||
@@ -27,9 +23,9 @@ Docker containers themselves. To achieve this, we need a separate "bootstrap" i
|
||||
Run:
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
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 &'
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
_Important Note_:
|
||||
@@ -42,17 +38,17 @@ across reboots and failures.
|
||||
Run:
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
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
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
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:
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
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" }'
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
|
||||
@@ -69,17 +65,17 @@ To re-configure Docker to use flannel, we need to take docker down, run flannel
|
||||
Turning down Docker is system dependent, it may be:
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
sudo /etc/init.d/docker stop
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
or
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
sudo systemctl stop docker
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
or it may be something else.
|
||||
@@ -89,9 +85,9 @@ or it may be something else.
|
||||
Now run flanneld itself:
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
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
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
The previous command should have printed a really long hash, copy this hash.
|
||||
@@ -99,9 +95,9 @@ The previous command should have printed a really long hash, copy this hash.
|
||||
Now get the subnet settings from flannel:
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
sudo docker -H unix:///var/run/docker-bootstrap.sock exec <really-long-hash-from-above-here> cat /run/flannel/subnet.env
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
#### Edit the docker configuration
|
||||
@@ -113,9 +109,9 @@ This may be in `/etc/default/docker` or `/etc/systemd/service/docker.service` or
|
||||
Regardless, you need to add the following to the docker command line:
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
--bip=${FLANNEL_SUBNET} --mtu=${FLANNEL_MTU}
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
#### Remove the existing Docker bridge
|
||||
@@ -123,10 +119,10 @@ Regardless, you need to add the following to the docker command line:
|
||||
Docker creates a bridge named `docker0` by default. You need to remove this:
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
sudo /sbin/ifconfig docker0 down
|
||||
sudo brctl delbr docker0
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
You may need to install the `bridge-utils` package for the `brctl` binary.
|
||||
@@ -136,17 +132,17 @@ You may need to install the `bridge-utils` package for the `brctl` binary.
|
||||
Again this is system dependent, it may be:
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
sudo /etc/init.d/docker start
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
it may be:
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
systemctl start docker
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
## Starting the Kubernetes Master
|
||||
@@ -154,7 +150,7 @@ systemctl start docker
|
||||
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.
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
sudo docker run \
|
||||
--volume=/:/rootfs:ro \
|
||||
--volume=/sys:/sys:ro \
|
||||
@@ -167,7 +163,7 @@ 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
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
> Note that `--cluster-dns` and `--cluster-domain` is used to deploy dns, feel free to discard them if dns is not needed.
|
||||
@@ -175,9 +171,9 @@ sudo docker run \
|
||||
### Also run the service proxy
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
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
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
### Test it out
|
||||
@@ -191,18 +187,18 @@ Download the kubectl binary and make it available by editing your PATH ENV.
|
||||
List the nodes
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
kubectl get nodes
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
This should print:
|
||||
|
||||
{% highlight console %}
|
||||
{% raw %}
|
||||
|
||||
NAME LABELS STATUS
|
||||
127.0.0.1 kubernetes.io/hostname=127.0.0.1 Ready
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
If the status of the node is `NotReady` or `Unknown` please check that all of the containers you created are successfully running.
|
||||
@@ -211,7 +207,7 @@ If all else fails, ask questions on [Slack](../../troubleshooting.html#slack).
|
||||
|
||||
### Next steps
|
||||
|
||||
Move on to [adding one or more workers](worker.html) or [deploy a dns](deployDNS.html)
|
||||
Move on to [adding one or more workers](worker) or [deploy a dns](deployDNS)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,26 +1,22 @@
|
||||
---
|
||||
title: "Testing your Kubernetes cluster."
|
||||
---
|
||||
|
||||
|
||||
## Testing your Kubernetes cluster.
|
||||
|
||||
To validate that your node(s) have been added, run:
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
kubectl get nodes
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
That should show something like:
|
||||
|
||||
{% highlight console %}
|
||||
{% raw %}
|
||||
|
||||
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
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
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).
|
||||
@@ -28,9 +24,9 @@ If the status of any node is `Unknown` or `NotReady` your cluster is broken, dou
|
||||
### Run an application
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
kubectl -s http://localhost:8080 run nginx --image=nginx --port=80
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
now run `docker ps` you should see nginx running. You may need to wait a few minutes for the image to get pulled.
|
||||
@@ -38,33 +34,33 @@ now run `docker ps` you should see nginx running. You may need to wait a few mi
|
||||
### Expose it as a service
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
kubectl expose rc nginx --port=80
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
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.
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
kubectl get svc nginx
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
Alternatively, you can obtain only the first IP (CLUSTER_IP) by running:
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
kubectl get svc nginx --template={{.spec.clusterIP}}
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
Hit the webserver with the first IP (CLUSTER_IP):
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
curl <insert-cluster-ip-here>
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
Note that you will need run this curl command on your boot2docker VM if you are running on OS X.
|
||||
@@ -74,17 +70,17 @@ Note that you will need run this curl command on your boot2docker VM if you are
|
||||
Now try to scale up the nginx you created before:
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
kubectl scale rc nginx --replicas=3
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
And list the pods
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
kubectl get pods
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
You should see pods landing on the newly added machine.
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
---
|
||||
title: "Adding a Kubernetes worker node via Docker."
|
||||
---
|
||||
|
||||
|
||||
## Adding a Kubernetes worker node via Docker.
|
||||
|
||||
|
||||
|
||||
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.html).
|
||||
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)
|
||||
@@ -32,9 +26,9 @@ As previously, we need a second instance of the Docker daemon running to bootstr
|
||||
Run:
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
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 &'
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
_Important Note_:
|
||||
@@ -48,17 +42,17 @@ To re-configure Docker to use flannel, we need to take docker down, run flannel
|
||||
Turning down Docker is system dependent, it may be:
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
sudo /etc/init.d/docker stop
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
or
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
sudo systemctl stop docker
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
or it may be something else.
|
||||
@@ -68,9 +62,9 @@ or it may be something else.
|
||||
Now run flanneld itself, this call is slightly different from the above, since we point it at the etcd instance on the master.
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
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
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
The previous command should have printed a really long hash, copy this hash.
|
||||
@@ -78,9 +72,9 @@ The previous command should have printed a really long hash, copy this hash.
|
||||
Now get the subnet settings from flannel:
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
sudo docker -H unix:///var/run/docker-bootstrap.sock exec <really-long-hash-from-above-here> cat /run/flannel/subnet.env
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
|
||||
@@ -93,9 +87,9 @@ This may be in `/etc/default/docker` or `/etc/systemd/service/docker.service` or
|
||||
Regardless, you need to add the following to the docker command line:
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
--bip=${FLANNEL_SUBNET} --mtu=${FLANNEL_MTU}
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
#### Remove the existing Docker bridge
|
||||
@@ -103,10 +97,10 @@ Regardless, you need to add the following to the docker command line:
|
||||
Docker creates a bridge named `docker0` by default. You need to remove this:
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
sudo /sbin/ifconfig docker0 down
|
||||
sudo brctl delbr docker0
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
You may need to install the `bridge-utils` package for the `brctl` binary.
|
||||
@@ -116,17 +110,17 @@ You may need to install the `bridge-utils` package for the `brctl` binary.
|
||||
Again this is system dependent, it may be:
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
sudo /etc/init.d/docker start
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
it may be:
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
systemctl start docker
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
### Start Kubernetes on the worker node
|
||||
@@ -136,7 +130,7 @@ systemctl start docker
|
||||
Again this is similar to the above, but the `--api-servers` now points to the master we set up in the beginning.
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
sudo docker run \
|
||||
--volume=/:/rootfs:ro \
|
||||
--volume=/sys:/sys:ro \
|
||||
@@ -149,7 +143,7 @@ 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
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
#### Run the service proxy
|
||||
@@ -157,14 +151,14 @@ sudo docker run \
|
||||
The service proxy provides load-balancing between groups of containers defined by Kubernetes `Services`
|
||||
|
||||
{% highlight sh %}
|
||||
{% raw %}
|
||||
|
||||
sudo docker run -d --net=host --privileged gcr.io/google_containers/hyperkube:v1.0.1 /hyperkube proxy --master=http://${MASTER_IP}:8080 --v=2
|
||||
{% endraw %}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
### Next steps
|
||||
|
||||
Move on to [testing your cluster](testing.html) or [add another node](#adding-a-kubernetes-worker-node-via-docker)
|
||||
Move on to [testing your cluster](testing) or [add another node](#adding-a-kubernetes-worker-node-via-docker)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user