From f31819b7571107484ef87f61f798266dcd13529d Mon Sep 17 00:00:00 2001 From: dvonthenen Date: Fri, 11 Oct 2019 12:41:42 -0700 Subject: [PATCH] Modify CPI to used k8s secrets Replace with * --- .../kubernetes-on-vsphere-with-kubeadm.md | 76 ++++++++++++++++--- 1 file changed, 66 insertions(+), 10 deletions(-) diff --git a/docs/book/tutorials/kubernetes-on-vsphere-with-kubeadm.md b/docs/book/tutorials/kubernetes-on-vsphere-with-kubeadm.md index 04236c58d..bde006d22 100644 --- a/docs/book/tutorials/kubernetes-on-vsphere-with-kubeadm.md +++ b/docs/book/tutorials/kubernetes-on-vsphere-with-kubeadm.md @@ -444,16 +444,22 @@ This cloud-config configmap file, passed to the CPI on initialization, contains ```bash # tee /etc/kubernetes/vsphere.conf >/dev/null <`, the vCenter IP address in the keys of `stringData`, and the `username` and `password` for each key. + +The secret for the vCenter at `1.1.1.1` might look like the following: + +```yaml +apiVersion: v1 +kind: Secret +metadata: + name: cpi-engineering-secret + namespace: kube-system +stringData: + 10.0.0.1.username: "administrator@vsphere.local" + 10.0.0.1.password: "password" +``` + +Then to create the secret, run the following command replacing the name of the YAML file with the one you have used: + +```bash +# kubectl create -f cpi-engineering-secret.yaml +``` + +Verify that the credential secret is successfully created in the kube-system namespace. + +```bash +# kubectl get secret cpi-engineering-secret --namespace=kube-system +NAME TYPE DATA AGE +cpi-engineering-secret Opaque 1 43s +``` + +If you have multiple vCenters as in the example vsphere.conf above, your Kubernetes Secret YAML could look like the following to storage the vCenter credentials for vCenters at `1.1.1.1` and `192.168.0.1`: + +```yaml +apiVersion: v1 +kind: Secret +metadata: + name: cpi-global-secret + namespace: kube-system +stringData: + 1.1.1.1.username: "administrator@vsphere.local" + 1.1.1.1.password: "password" + 192.168.0.1.username: "administrator@vsphere.local" + 192.168.0.1.password: "password" +``` ### Zones and Regions for Pod and Volume Placement - CPI