Created
February 24, 2018 15:35
-
-
Save rezamt/0de61b2e675080f898fe38f22b1be794 to your computer and use it in GitHub Desktop.
K8s on Vagrant + Virtual box
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
# Setting up a cluster is as simple as running: | |
export KUBERNETES_PROVIDER=vagrant | |
curl -sS https://get.k8s.io | bash | |
# Will download kubernetes-server-linux-amd64.tar.gz from https://dl.k8s.io/v1.9.3 | |
# Will download and extract kubernetes-client-darwin-amd64.tar.gz from https://dl.k8s.io/v1.9.3 | |
# then specify number of running nodes (master + worker) | |
export NUM_NODES=3 | |
# export VAGRANT_DEFAULT_PROVIDER=virtualbox | |
export KUBERNETES_PROVIDER=vagrant | |
./cluster/kube-up.sh | |
# To view the service status and/or logs on the kubernetes-master: | |
vagrant ssh master | |
sudo su | |
systemctl status kubelet | |
journalctl -ru kubelet | |
systemctl status docker | |
journalctl -ru docker | |
tail -f /var/log/kube-apiserver.log | |
tail -f /var/log/kube-controller-manager.log | |
tail -f /var/log/kube-scheduler.log | |
# To view the services on any of the nodes: | |
vagrant ssh node-1 | |
sudo su | |
systemctl status kubelet | |
journalctl -ru kubelet | |
systemctl status docker | |
journalctl -ru docker | |
# Interacting with your Kubernetes cluster with Vagrant. | |
./cluster/kube-push.sh | |
# To stop and then restart the cluster: | |
vagrant halt | |
./cluster/kube-up.sh | |
# To destroy the cluster: | |
vagrant destroy | |
# Once your Vagrant machines are up and provisioned, the first thing to do is | |
# to check that you can use the kubectl.sh script. | |
# | |
# Note: You may need to build the binaries first, you can do this with make | |
./cluster/kubectl.sh get nodes | |
# Download the following boxes: | |
https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_fedora-23_chef-provisionerless.box | |
# and store it in your kubernetes/virtualbox | |
# then refer to it by setting the following commands (probably changing kube-up.sh | |
export KUBERNETES_BOX_NAME=kube-fedora23 | |
export KUBERNETES_BOX_URL=./virtualbox/opscode_fedora-23_chef-provisionerless.box | |
export KUBERNETES_PROVIDER=vagrant | |
./cluster/kube-up.sh | |
# References | |
# https://kubernetes-v1-4.github.io/docs/getting-started-guides/vagrant/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment