Merge pull request #250 from vishh/localcluster
Fix several issues with the local docker based cluster documentation.pull/254/head
commit
d3cd373942
|
@ -28,6 +28,7 @@ docker run \
|
|||
--net=host \
|
||||
--pid=host \
|
||||
--privileged=true \
|
||||
--name=kubelet \
|
||||
-d \
|
||||
gcr.io/google_containers/hyperkube-amd64:v${K8S_VERSION} \
|
||||
/hyperkube kubelet \
|
||||
|
@ -120,59 +121,69 @@ Now run `docker ps` you should see nginx running. You may need to wait a few mi
|
|||
kubectl expose deployment 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 (if a LoadBalancer is configured)
|
||||
Run the following command to obtain the cluster local IP of this service we just created:
|
||||
|
||||
```shell
|
||||
kubectl get svc nginx
|
||||
```
|
||||
```shell{% raw %}
|
||||
ip=$(kubectl get svc nginx --template={{.spec.clusterIP}})
|
||||
echo $ip
|
||||
{% endraw %}```
|
||||
|
||||
Alternatively, you can obtain only the first IP (CLUSTER_IP) by running:
|
||||
Hit the webserver with this IP:
|
||||
|
||||
```shell{% raw %}
|
||||
kubectl get svc nginx --template={{.spec.clusterIP}}
|
||||
{% endraw %}```
|
||||
|
||||
Hit the webserver with the first IP (CLUSTER_IP):
|
||||
|
||||
On OS X, since docker is running inside a VM, run the following command instead:
|
||||
```shell
|
||||
curl <insert-cluster-ip-here>
|
||||
docker-machine ssh `docker-machine active` curl $ip
|
||||
```
|
||||
|
||||
Note that you will need run this curl command on your boot2docker VM if you are running on OS X.
|
||||
|
||||
## Deploy a DNS
|
||||
|
||||
See [here](/docs/getting-started-guides/docker-multinode/deployDNS/) for instructions.
|
||||
|
||||
### A note on turning down your cluster
|
||||
### Turning down your cluster
|
||||
|
||||
Many of these containers run under the management of the `kubelet` binary, which attempts to keep containers running, even if they fail. So, in order to turn down
|
||||
the cluster, you need to first kill the kubelet container, and then any other containers.
|
||||
1. Delete all the containers including the kubelet:
|
||||
|
||||
Many of these containers run under the management of the `kubelet` binary, which attempts to keep containers running, even if they fail.
|
||||
So, in order to turn down the cluster, you need to first kill the kubelet container, and then any other containers.
|
||||
|
||||
You may use `docker kill $(docker ps -aq)`, note this removes _all_ containers running under Docker, so use with caution.
|
||||
|
||||
2. Cleanup the filesystem:
|
||||
|
||||
On OS X, first ssh into the docker VM:
|
||||
|
||||
```shell
|
||||
docker-machine ssh `docker-machine active`
|
||||
```
|
||||
|
||||
```shell
|
||||
sudo umount `cat /proc/mounts | grep /var/lib/kubelet | awk '{print $2}'`
|
||||
sudo rm -rf /var/lib/kubelet
|
||||
```
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
#### Node is in `NotReady` state
|
||||
|
||||
If you see your node as `NotReady` it's possible that your OS does not have memcg and swap enabled.
|
||||
If you see your node as `NotReady` it's possible that your OS does not have memcg enabled.
|
||||
|
||||
1. Your kernel should support memory and swap accounting. Ensure that the
|
||||
1. Your kernel should support memory accounting. Ensure that the
|
||||
following configs are turned on in your linux kernel:
|
||||
|
||||
```shell
|
||||
CONFIG_RESOURCE_COUNTERS=y
|
||||
CONFIG_MEMCG=y
|
||||
CONFIG_MEMCG_SWAP=y
|
||||
CONFIG_MEMCG_SWAP_ENABLED=y
|
||||
CONFIG_MEMCG_KMEM=y
|
||||
```
|
||||
|
||||
2. Enable the memory and swap accounting in the kernel, at boot, as command line
|
||||
2. Enable the memory accounting in the kernel, at boot, as command line
|
||||
parameters as follows:
|
||||
|
||||
```shell
|
||||
GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"
|
||||
GRUB_CMDLINE_LINUX="cgroup_enable=memory=1"
|
||||
```
|
||||
|
||||
NOTE: The above is specifically for GRUB2.
|
||||
|
@ -181,5 +192,5 @@ parameters as follows:
|
|||
|
||||
```shell
|
||||
$ cat /proc/cmdline
|
||||
BOOT_IMAGE=/boot/vmlinuz-3.18.4-aufs root=/dev/sda5 ro cgroup_enable=memory swapaccount=1
|
||||
BOOT_IMAGE=/boot/vmlinuz-3.18.4-aufs root=/dev/sda5 ro cgroup_enable=memory=1
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue