|
1 | | -export KUBERNETES_PROVIDER=vagrant |
| 1 | +# Booting Kubernetes Using Vagrant |
2 | 2 |
|
3 | | -kubectl should be working |
| 3 | +This guide will walk you through the process of installing a small development |
| 4 | +Kubernetes cluster on your local machine. |
4 | 5 |
|
5 | | -[next install workflow](install-vagrant.md) |
| 6 | +## Pre-requisites |
| 7 | + |
| 8 | +1. Install latest version >= 1.7.4 of vagrant from http://www.vagrantup.com/downloads.html |
| 9 | +2. Install one of: |
| 10 | + 1. The latest version of [Virtual Box](https://www.virtualbox.org/wiki/Downloads) |
| 11 | + 2. [VMWare Fusion](https://www.vmware.com/products/fusion/) version 5 or greater as well as the appropriate [Vagrant VMWare Fusion provider](https://www.vagrantup.com/vmware) |
| 12 | + 3. [VMWare Workstation](https://www.vmware.com/products/workstation/) version 9 or greater as well as the [Vagrant VMWare Workstation provider](https://www.vagrantup.com/vmware) |
| 13 | + 4. [Parallels Desktop](https://www.parallels.com/products/desktop/) version 9 or greater as well as the [Vagrant Parallels provider](https://parallels.github.io/vagrant-parallels/) |
| 14 | +3. At least 4GB of RAM for the virtual machines. |
| 15 | + |
| 16 | +## Download and Unpack Kubernetes |
| 17 | + |
| 18 | +First, make a directory to hold the Kubernetes release files: |
| 19 | + |
| 20 | +``` |
| 21 | +$ mkdir my-first-cluster |
| 22 | +$ cd my-first-cluster |
| 23 | +``` |
| 24 | + |
| 25 | +Download Kubernetes release v1.2.4, and extract the archive on your machine. |
| 26 | + |
| 27 | +This archive has everything that you need to launch Kubernetes. It weighs in around 500MB, so it may take some time to download: |
| 28 | + |
| 29 | +``` |
| 30 | +$ curl -sSL https://storage.googleapis.com/kubernetes-release/release/v1.2.4/kubernetes.tar.gz -O |
| 31 | +$ tar -xvzf kubernetes.tar.gz |
| 32 | +$ cd kubernetes |
| 33 | +$ ls |
| 34 | +LICENSES README.md Vagrantfile cluster/ contrib/ docs/ examples/ platforms/ server/ third_party/ version |
| 35 | +``` |
| 36 | + |
| 37 | +## Configure the Kubernetes Environment |
| 38 | + |
| 39 | +Before calling the Kubernetes setup scripts, we need to change a few defaults so that Deis Workflow works best. Type |
| 40 | +each of these commands into your terminal application before calling `kube-up.sh`. |
| 41 | + |
| 42 | +First, enable insecure registry support for Docker and use Vagrant as the provider: |
| 43 | +``` |
| 44 | +$ export KUBE_ENABLE_INSECURE_REGISTRY=true |
| 45 | +$ export KUBERNETES_PROVIDER=vagrant |
| 46 | +``` |
| 47 | + |
| 48 | +For evaluation, we find that the worker nodes need a bit more memory than the default 1GB. We will allocate 1.5GB for |
| 49 | +the master node and 4GB for the worker node: |
| 50 | + |
| 51 | +``` |
| 52 | +export KUBERNETES_MASTER_MEMORY=1536 |
| 53 | +export KUBERNETES_NODE_MEMORY=4096 |
| 54 | +``` |
| 55 | + |
| 56 | +Double check the configured environment variables: |
| 57 | + |
| 58 | +``` |
| 59 | +$ env | grep KUBE |
| 60 | +KUBE_ENABLE_INSECURE_REGISTRY=true |
| 61 | +KUBERNETES_PROVIDER=vagrant |
| 62 | +KUBERNETES_NODE_MEMORY=4096 |
| 63 | +KUBERNETES_MASTER_MEMORY=1536 |
| 64 | +``` |
| 65 | + |
| 66 | +## Boot Your First Cluster |
| 67 | + |
| 68 | +We are now ready to boot our first Kubernetes cluster on AWS! |
| 69 | + |
| 70 | +Since this script does a **lot** of stuff, we'll break it into sections. |
| 71 | + |
| 72 | +``` |
| 73 | +kubernetes $ ./cluster/kube-up.sh |
| 74 | +... Starting cluster using provider: vagrant |
| 75 | +... calling verify-prereqs |
| 76 | +... calling kube-up |
| 77 | +Bringing machine 'master' up with 'virtualbox' provider... |
| 78 | +Bringing machine 'node-1' up with 'virtualbox' provider... |
| 79 | +==> master: Box 'kube-fedora23' could not be found. Attempting to find and install... |
| 80 | +
|
| 81 | +...REDACTED... |
| 82 | +
|
| 83 | +``` |
| 84 | + |
| 85 | +Two machines have been created via vagrant, `master` and `node-1`. The step downloads a load of packages and sets up |
| 86 | +Kubernetes so it can take some time. |
| 87 | + |
| 88 | +``` |
| 89 | +cluster "vagrant" set. |
| 90 | +user "vagrant" set. |
| 91 | +context "vagrant" set. |
| 92 | +switched to context "vagrant". |
| 93 | +user "vagrant-basic-auth" set. |
| 94 | +Wrote config for vagrant to /Users/jhansen/.kube/config |
| 95 | +Each machine instance has been created/updated. |
| 96 | + Now waiting for the Salt provisioning process to complete on each machine. |
| 97 | + This can take some time based on your network, disk, and cpu speed. |
| 98 | + It is possible for an error to occur during Salt provision of cluster and this could loop forever. |
| 99 | +Validating master |
| 100 | +Validating node-1 |
| 101 | +``` |
| 102 | + |
| 103 | +Now that the master is up and ready, `kube-up.sh` automatically configures `kubectl` on your machine with appropriate |
| 104 | +authentication and endpoint information. |
| 105 | + |
| 106 | +``` |
| 107 | +Kubernetes cluster is running. |
| 108 | +
|
| 109 | +The master is running at: |
| 110 | +
|
| 111 | + https://10.245.1.2 |
| 112 | +
|
| 113 | +Administer and visualize its resources using Cockpit: |
| 114 | +
|
| 115 | + https://10.245.1.2:9090 |
| 116 | +
|
| 117 | +For more information on Cockpit, visit http://cockpit-project.org |
| 118 | +
|
| 119 | +The user name and password to use is located in /Users/jhansen/.kube/config |
| 120 | +
|
| 121 | +... calling validate-cluster |
| 122 | +Found 1 node(s). |
| 123 | +NAME STATUS AGE |
| 124 | +kubernetes-node-1 Ready 1m |
| 125 | +Flag --api-version has been deprecated, flag is no longer respected and will be deleted in the next release |
| 126 | +Validate output: |
| 127 | +NAME STATUS MESSAGE ERROR |
| 128 | +controller-manager Healthy ok |
| 129 | +scheduler Healthy ok |
| 130 | +etcd-1 Healthy {"health": "true"} |
| 131 | +etcd-0 Healthy {"health": "true"} |
| 132 | +Cluster validation succeeded |
| 133 | +Done, listing cluster services: |
| 134 | +
|
| 135 | +Kubernetes master is running at https://10.245.1.2 |
| 136 | +Heapster is running at https://10.245.1.2/api/v1/proxy/namespaces/kube-system/services/heapster |
| 137 | +KubeDNS is running at https://10.245.1.2/api/v1/proxy/namespaces/kube-system/services/kube-dns |
| 138 | +kubernetes-dashboard is running at https://10.245.1.2/api/v1/proxy/namespaces/kube-system/services/kubernetes-dashboard |
| 139 | +Grafana is running at https://10.245.1.2/api/v1/proxy/namespaces/kube-system/services/monitoring-grafana |
| 140 | +InfluxDB is running at https://10.245.1.2/api/v1/proxy/namespaces/kube-system/services/monitoring-influxdb |
| 141 | +``` |
| 142 | + |
| 143 | +You are now ready to [install Deis Workflow](install-vagrant.md) |
0 commit comments