2016-02-24 21:47:57 +00:00
---
2016-07-29 17:36:25 +00:00
assignees:
- erictune
- jbeda
2016-12-15 20:16:54 +00:00
title: VMware vSphere
2016-02-24 21:47:57 +00:00
---
2016-03-07 02:29:06 +00:00
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).
2016-02-26 11:54:48 +00:00
* TOC
2016-03-07 02:29:06 +00:00
{:toc}
### Prerequisites
2016-08-02 03:09:17 +00:00
1. You need administrator credentials to an ESXi machine or vCenter instance with write mode api access enabled (not available on the free ESXi license).
2016-03-07 02:29:06 +00:00
2. You must have Go (see [here ](https://github.com/kubernetes/kubernetes/tree/{{page.githubbranch}}/docs/devel/development.md#go-versions ) for supported versions) installed: [www.golang.org ](http://www.golang.org ).
3. You must have your `GOPATH` set up and include `$GOPATH/bin` in your `PATH` .
2016-02-26 11:54:48 +00:00
```shell
2016-03-07 02:29:06 +00:00
export GOPATH=$HOME/src/go
mkdir -p $GOPATH
export PATH=$PATH:$GOPATH/bin
2016-02-26 11:54:48 +00:00
```
2016-08-30 21:31:38 +00:00
4. Install the govc tool to interact with ESXi/vCenter. Head to [govc Releases ](https://github.com/vmware/govmomi/releases ) to download the latest.
2016-03-07 02:29:06 +00:00
2016-02-26 11:54:48 +00:00
```shell
2016-08-30 21:31:38 +00:00
# Sample commands for v0.8.0 for 64 bit Linux.
curl -OL https://github.com/vmware/govmomi/releases/download/v0.8.0/govc_linux_amd64.gz
gzip -d govc_linux_amd64.gz
chmod +x govc_linux_amd64
mv govc_linux_amd64 /usr/local/bin/govc
2016-02-26 11:54:48 +00:00
```
2016-03-07 02:29:06 +00:00
5. Get or build a [binary release ](/docs/getting-started-guides/binary_release )
### Setup
Download a prebuilt Debian 8.2 VMDK that we'll use as a base image:
2016-02-26 11:54:48 +00:00
```shell
2016-03-07 02:29:06 +00:00
curl --remote-name-all https://storage.googleapis.com/govmomi/vmdk/2016-01-08/kube.vmdk.gz{,.md5}
md5sum -c kube.vmdk.gz.md5
gzip -d kube.vmdk.gz
2016-02-26 11:54:48 +00:00
```
2016-08-30 21:31:38 +00:00
Configure the environment for govc
2016-03-07 02:29:06 +00:00
2016-02-26 11:54:48 +00:00
```shell
2016-03-07 02:29:06 +00:00
export GOVC_URL='hostname' # hostname of the vc
2016-03-06 17:55:12 +00:00
export GOVC_USERNAME='username' # username for logging into the vsphere.
export GOVC_PASSWORD='password' # password for the above username
export GOVC_NETWORK='Network Name' # Name of the network the vms should join. Many times it could be "VM Network"
2016-03-07 02:29:06 +00:00
export GOVC_INSECURE=1 # If the host above uses a self-signed cert
export GOVC_DATASTORE='target datastore'
2016-08-30 21:31:38 +00:00
# To get resource pool via govc: govc ls -l 'host/*' | grep ResourcePool | awk '{print $1}' | xargs -n1 -t govc pool.info
2016-03-07 02:29:06 +00:00
export GOVC_RESOURCE_POOL='resource pool or cluster with access to datastore'
2016-08-10 09:44:55 +00:00
export GOVC_GUEST_LOGIN='kube:kube' # Used for logging into kube.vmdk during deployment.
2016-08-30 21:31:38 +00:00
export GOVC_PORT=443 # The port to be used by vSphere cloud provider plugin
# To get datacente via govc: govc datacenter.info
export GOVC_DATACENTER='ha-datacenter' # The datacenter to be used by vSphere cloud provider plugin
```
Sample environment
2016-11-17 19:20:29 +00:00
2016-08-30 21:31:38 +00:00
```shell
export GOVC_URL='10.161.236.217'
export GOVC_USERNAME='administrator'
export GOVC_PASSWORD='MyPassword1'
export GOVC_NETWORK='VM Network'
export GOVC_INSECURE=1
export GOVC_DATASTORE='datastore1'
export GOVC_RESOURCE_POOL='/Datacenter/host/10.20.104.24/Resources'
export GOVC_GUEST_LOGIN='kube:kube'
export GOVC_PORT='443'
export GOVC_DATACENTER='Datacenter'
```
2016-03-07 02:29:06 +00:00
2016-08-30 21:31:38 +00:00
Import this VMDK into your vSphere datastore:
2016-11-17 19:20:29 +00:00
2016-08-30 21:31:38 +00:00
```shell
2016-03-07 02:29:06 +00:00
govc import.vmdk kube.vmdk ./kube/
2016-02-26 11:54:48 +00:00
```
2016-03-07 02:29:06 +00:00
Verify that the VMDK was correctly uploaded and expanded to ~3GiB:
2016-02-26 11:54:48 +00:00
```shell
2016-03-07 02:29:06 +00:00
govc datastore.ls ./kube/
2016-02-26 11:54:48 +00:00
```
2016-08-30 21:31:38 +00:00
2016-08-10 09:39:47 +00:00
If you need to debug any part of the deployment, the guest login for
the image that you imported is `kube:kube` . It is normally specified
in the GOVC_GUEST_LOGIN parameter above.
2016-03-07 02:29:06 +00:00
2016-06-27 23:32:59 +00:00
Also take a look at the file `cluster/vsphere/config-default.sh` and
make any needed changes. You can configure the number of nodes
as well as the IP subnets you have made available to Kubernetes, pods,
and services.
2016-03-07 02:29:06 +00:00
### Starting a cluster
Now, let's continue with deploying Kubernetes.
This process takes about ~20-30 minutes depending on your network.
2016-03-06 17:55:12 +00:00
#### From extracted binary release
```shell
cd kubernetes
KUBERNETES_PROVIDER=vsphere cluster/kube-up.sh
```
2016-03-07 02:29:06 +00:00
2016-03-06 17:55:12 +00:00
#### Build from source
2016-03-07 02:29:06 +00:00
2016-02-26 11:54:48 +00:00
```shell
2016-03-07 02:29:06 +00:00
cd kubernetes
2016-03-06 17:55:12 +00:00
make release
KUBERNETES_PROVIDER=vsphere cluster/kube-up.sh
2016-02-26 11:54:48 +00:00
```
2016-03-07 02:29:06 +00:00
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
2016-03-06 17:55:12 +00:00
`kube` otherwise).
2016-05-22 22:17:54 +00:00
## Support Level
IaaS Provider | Config. Mgmt | OS | Networking | Docs | Conforms | Support Level
-------------------- | ------------ | ------ | ---------- | --------------------------------------------- | ---------| ----------------------------
2016-08-30 21:31:38 +00:00
Vmware vSphere | Saltstack | Debian | OVS | [docs ](/docs/getting-started-guides/vsphere ) | | Community ([@imkin](https://github.com/imkin)), ([@abrarshivani](https://github.com/abrarshivani)), ([@kerneltime](https://github.com/kerneltime)), ([@kerneltime](https://github.com/luomiao))
2016-05-22 22:17:54 +00:00
For support level information on all solutions, see the [Table of solutions ](/docs/getting-started-guides/#table-of-solutions ) chart.