Last active
October 8, 2016 15:30
-
-
Save fernandoacorreia/d55da101eaa0cfb46f4ab6b6ff8cae77 to your computer and use it in GitHub Desktop.
Run kubernetes in docker as described in https://github.com/kubernetes/kubernetes/blob/master/docs/devel/local-cluster/docker.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Run `start-kubernetes` to create the Kubernetes docker container. | |
Install kubectl and run `kubectl --server=http://localhost:8080 cluster-info` to see useful URLs. | |
Delete everything by running `remove-kubernetes`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Removing Kubernetes" | |
docker rm -f kubelet || echo "Failed to remove kubelet" | |
docker rm -f `docker ps -a | grep k8s | awk '{print $1}'` || echo "Failed to remove containers" | |
grep /var/lib/kubelet /proc/mounts | awk '{print $2}' | sudo xargs -n1 umount || echo "Failed to un-mount -- running again might work" | |
sudo rm -rf /var/lib/kubelet || echo "Failed to remove directory" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ ! -d "/var/lib/kubelet" ]; then | |
sudo mkdir -p /var/lib/kubelet | |
sudo mount --bind /var/lib/kubelet /var/lib/kubelet | |
sudo mount --make-shared /var/lib/kubelet | |
fi | |
export K8S_VERSION=v1.3.5 | |
export ARCH=amd64 | |
docker run -d \ | |
--volume=/sys:/sys:rw \ | |
--volume=/var/lib/docker/:/var/lib/docker:rw \ | |
--volume=/var/lib/kubelet/:/var/lib/kubelet:rw,shared \ | |
--volume=/var/run:/var/run:rw \ | |
--net=host \ | |
--pid=host \ | |
--privileged \ | |
--name=kubelet \ | |
gcr.io/google_containers/hyperkube-${ARCH}:${K8S_VERSION} \ | |
/hyperkube kubelet \ | |
--hostname-override=127.0.0.1 \ | |
--api-servers=http://localhost:8080 \ | |
--config=/etc/kubernetes/manifests \ | |
--cluster-dns=10.0.0.10 \ | |
--cluster-domain=cluster.local \ | |
--allow-privileged --v=2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment