Last active
November 6, 2015 08:14
-
-
Save narita1980/cf716397f8922e767726 to your computer and use it in GitHub Desktop.
Running Kubernetes locally via Docker
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
# Refer | |
# https://github.com/kubernetes/kubernetes/blob/master/docs/getting-started-guides/docker.md | |
# curl -L https://gist.githubusercontent.com/takashi209/cf716397f8922e767726/raw/323d80be17880527d43eb50427555e0d78b0381f/running_kubernetes_locally_via_docker.sh | bash | |
CONFIG_RESOURCE_COUNTERS=y | |
CONFIG_MEMCG=y | |
CONFIG_MEMCG_SWAP=y | |
CONFIG_MEMCG_SWAP_ENABLED=y | |
CONFIG_MEMCG_KMEM=y | |
GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1" | |
# Step One: Run etcd | |
docker run --net=host -d gcr.io/google_containers/etcd:2.2.1 /usr/local/bin/etcd --addr=127.0.0.1:4001 --bind-addr=0.0.0.0:4001 --data-dir=/var/etcd/data | |
# Step Two: Run the master | |
docker run \ | |
--volume=/:/rootfs:ro \ | |
--volume=/sys:/sys:ro \ | |
--volume=/dev:/dev \ | |
--volume=/var/lib/docker/:/var/lib/docker:rw \ | |
--volume=/var/lib/kubelet/:/var/lib/kubelet:rw \ | |
--volume=/var/run:/var/run:rw \ | |
--net=host \ | |
--pid=host \ | |
--privileged=true \ | |
-d \ | |
gcr.io/google_containers/hyperkube:v1.0.6 \ | |
/hyperkube kubelet --containerized --hostname-override="127.0.0.1" --address="0.0.0.0" --api-servers=http://localhost:8080 --config=/etc/kubernetes/manifests | |
# Step Three: Run the service proxy | |
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 | |
# Install and configure kubectl | |
sudo wget https://storage.googleapis.com/kubernetes-release/release/v1.0.1/bin/linux/amd64/kubectl | |
sudo chmod +x kubectl | |
sudo mv kubectl /usr/local/bin/ | |
# Test it out | |
kubectl get nodes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ここを参考にシェルを作成
https://github.com/kubernetes/kubernetes/blob/master/docs/getting-started-guides/docker.md