Vsphere-cloud-provider docs - index

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 and 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