k3s/docs/getting-started-guides/vsphere.md

81 lines
2.3 KiB
Markdown
Raw Normal View History

2014-08-25 03:19:28 +00:00
## Getting started with vSphere
The example below creates a Kubernetes cluster with 4 worker node Virtual
Machines and a master Virtual Machine (i.e. 5 VMs in your cluster). This
cluster is set up and controlled from your workstation (or wherever you find
convenient).
2014-08-25 03:19:28 +00:00
### Prerequisites
1. You need administrator credentials to an ESXi machine or vCenter instance.
2. You must have Go (version 1.2 or later) installed: [www.golang.org](http://www.golang.org).
2014-08-25 17:01:25 +00:00
3. You must have your `GOPATH` set up and include `$GOPATH/bin` in your `PATH`.
```sh
export GOPATH=$HOME/src/go
mkdir -p $GOPATH
export PATH=$PATH:$GOPATH/bin
```
4. Install the govc tool to interact with ESXi/vCenter:
2014-08-25 03:19:28 +00:00
```sh
go get github.com/vmware/govmomi/govc
```
2014-08-25 17:01:25 +00:00
5. Get or build a [binary release](binary_release.md)
2014-08-25 03:19:28 +00:00
### Setup
Download a prebuilt Debian VMDK to be used as base image:
```sh
2014-08-25 17:01:25 +00:00
wget https://storage.googleapis.com/govmomi/vmdk/kube.vmdk.gz{,.md5}
2014-08-25 03:19:28 +00:00
md5sum -c kube.vmdk.gz.md5
gzip -d kube.vmdk.gz
```
Upload this VMDK to your vSphere instance:
```sh
export GOVC_URL='user:pass@hostname'
2014-09-10 00:17:41 +00:00
export GOVC_INSECURE=1 # If the host above uses a self-signed cert
2014-08-25 03:19:28 +00:00
export GOVC_DATASTORE='target datastore'
2014-09-10 00:17:41 +00:00
export GOVC_RESOURCE_POOL='resource pool or cluster with access to datastore'
2014-08-25 03:19:28 +00:00
2014-09-10 00:17:41 +00:00
govc import.vmdk kube.vmdk ./kube/
2014-08-25 03:19:28 +00:00
```
Verify that the VMDK was correctly uploaded and expanded to 10GiB:
```sh
2014-09-10 00:17:41 +00:00
govc datastore.ls ./kube/
2014-08-25 03:19:28 +00:00
```
Take a look at the file `cluster/vsphere/config-common.sh` fill in the required
parameters. The guest login for the image that you imported is `kube:kube`.
### Starting a cluster
2014-08-25 03:19:28 +00:00
Now, let's continue with deploying Kubernetes.
This process takes about ~10 minutes.
2014-08-25 03:19:28 +00:00
```sh
2014-10-29 20:00:47 +00:00
cd kubernetes # Extracted binary release OR repository root
2014-08-25 03:19:28 +00:00
export KUBERNETES_PROVIDER=vsphere
cluster/kube-up.sh
```
Refer to the top level README and the getting started guide for Google Compute
Engine. Once you have successfully reached this point, your vSphere Kubernetes
deployment works just as any other one!
**Enjoy!**
### Extra: debugging deployment failure
The output of `kube-up.sh` displays the IP addresses of the VMs it deploys. You
can log into any VM as the `kube` user to poke around and figure out what is
going on (find yourself authorized with your SSH key, or use the password
`kube` otherwise).