---
title: Charmhub | Deploy vSphere Cloud Provider using Charmhub - The Open Operator
  Collection
description: Deploy the latest version of vSphere Cloud Provider on any cloud. Runs
  the vSphere Cloud Provider in the cluster.
url: https://charmhub.io/vsphere-cloud-provider
---

# vSphere Cloud Provider

[Canonical Kubernetes](https://charmhub.io/publisher/containers "View all packages from Canonical Kubernetes")

* [Canonical Kubernetes](https://charmhub.io/publisher/containers "View all packages from Canonical Kubernetes")

Platform:

24.04

22.04

20.04

stable 1ed1b78

```
juju deploy vsphere-cloud-provider
```

[Learn to deploy on juju >](https://juju.is/docs/juju/manage-applications)

---

#### Relevant links

* [Contact](https://launchpad.net/~containers)

---

#### Contacts

##### Maintainers

* [Submit a bug](https://bugs.launchpad.net/charm-vsphere-cloud-provider)

---

Share your thoughts on this charm with the community on discourse.

[Join the discussion](https://discourse.charmhub.io/)

This charm encapsulates the out-of-tree Kubernetes vSphere Cloud Provider, including both the Cloud Provider Interface (CPI) and the Container Storage Interface (CSI) components along with related lifecycle operations.

This charm is built using the charmcraft ops framework.

# Deployment

This charm is not functional when deployed by itself. It requires an existing Kubernetes cluster as well as the vsphere-integrator charm installed and trusted in a Juju vSphere environment. By default, the vsphere-integrator charm will enable vsphere capabilities using the in-tree cloud provider. However, it is recommended to use the out-of-tree provider for more control of CPI/CSI configuration and maintenance.

Deployment requires the vsphere-integrator and a few relations:

* Existing Deployment

```
juju deploy vsphere-cloud-provider

# removes in-tree provider
juju remove-relation vsphere-integrator:clients kubernetes-control-plane
juju remove-relation vsphere-integrator:clients kubernetes-worker

# configures out-of-tree provider
juju relate vsphere-cloud-provider:certificates            easyrsa
juju relate vsphere-cloud-provider:kube-control            kubernetes-control-plane
juju relate vsphere-cloud-provider:external-cloud-provider kubernetes-control-plane
juju relate vsphere-cloud-provider                         vsphere-integrator:clients

##  wait for the vsphere controller daemonset to be running
kubectl get ds -n kube-system
```

* New Deployment

```
juju deploy charmed-kubernetes
juju deploy vsphere-integrator --trust
juju deploy vsphere-cloud-provider

juju relate vsphere-cloud-provider:certificates            easyrsa
juju relate vsphere-cloud-provider:kube-control            kubernetes-control-plane
juju relate vsphere-cloud-provider:external-cloud-provider kubernetes-control-plane
juju relate vsphere-cloud-provider                         vsphere-integrator

##  wait for the vsphere controller daemonset to be running
kubectl get ds -n kube-system
```

This will deploy the most recent [vsphere cloud-provider](https://github.com/kubernetes/cloud-provider-vsphere) and [vsphere csi-driver](https://github.com/kubernetes-sigs/vsphere-csi-driver/) supported by the charm. See all supported versions with:

```
juju run-action vsphere-cloud-provider/leader --wait list-versions
```

# Resources Created

Deployment of this charm provides a storage class that can be used to create PVs or PVCs on your vsphere cluster.

For a list of all kubernetes resources installed by this charm, run the following:

```
juju run-action vsphere-cloud-provider/leader --wait list-resources
```

# Examples

## Creating a pod with a PersistentDisk-backed volume

This script creates a busybox pod with a persistent volume claim backed by vSphere’s PersistentDisk.

```
#!/bin/bash

# create a persistent volume claim using the charm's storage class
kubectl create -f - <<EOY
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: testclaim
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Mi
  storageClassName: csi-vsphere-default
EOY

# create the busybox pod with a volume using that PVC:
kubectl create -f - <<EOY
apiVersion: v1
kind: Pod
metadata:
  name: busybox
  namespace: default
spec:
  containers:
    - image: busybox
      command:
        - sleep
        - "3600"
      imagePullPolicy: IfNotPresent
      name: busybox
      volumeMounts:
        - mountPath: "/pv"
          name: testvolume
  restartPolicy: Always
  volumes:
    - name: testvolume
      persistentVolumeClaim:
        claimName: testclaim
EOY
```

---

[Help improve this document in the forum](https://discourse.charmhub.io/t/vsphere-cloud-provider-docs-index/6563) ([guidelines](https://discourse.charmhub.io/t/how-to-write-docs-our-documentation-guidelines-for-contributors/1245)). Last updated 3 years ago.
