On Master and Worker nodes:
-
Generate
/etc/kubernetes/cloud-config
file -
Add to
/etc/sysconfig/kubelet
KUBELET_EXTRA_ARGS="--cloud-provider=openstack --cloud-config=/etc/kubernetes/cloud-config"
On Master nodes:
- Add
/etc/kubernetes/manifests/kube-apiserver.yaml
and/etc/kubernetes/manifests/kube-controller-manager.yaml
- --cloud-provider=openstack
- --cloud-config=/etc/kubernetes/cloud-config
- mountPath: /etc/kubernetes/cloud-config
name: cloud-config
readOnly: true
- hostPath:
path: /etc/kubernetes/cloud-config
type: FileOrCreate
name: cloud-config
On Master and Worker nodes:
- Restart kubelet service
systemctl restart kubelet
On Master and Worker nodes:
- Add to
/etc/sysconfig/kubelet
KUBELET_EXTRA_ARGS="--cloud-provider=external"
- Restart kubelet service
systemctl restart kubelet
On Master node:
-
Update and copy
cloud-config
to/etc/kubernetes/cloud-config
-
Add
"- --cloud-provider=external"
to configuration to:
/etc/kubernetes/manifests/kube-apiserver.yaml
/etc/kubernetes/manifests/kube-controller-manager.yaml
- Restart kubelet service
systemctl restart kubelet
-
Copy manifests folder on Master node:
-
Create
cloud-config
secret
export CLOUD_CONFIG=/etc/kubernetes/cloud-config
kubectl create secret -n kube-system generic cloud-config --from-literal=cloud.conf="$(cat $CLOUD_CONFIG)" --dry-run -o yaml > manifests/cloud-config-secret.yaml
kubectl apply -f manifests/cloud-config-secret.yaml
- Create cloud-controller-manager ServiceAccount
kubectl apply -f manifests/cpi-service-account.yaml
- Create RBAC for cloud-controller-manager
kubectl apply -f manifests/rbac/cloud-controller-manager-roles.yaml
kubectl apply -f manifests/rbac/cloud-controller-manager-role-bindings.yaml
- Deploy cloud-controller-manager pod
kubectl apply -f manifests/cloud-controller-manager.yaml
- Check logs of cloud-controller-manager
kubectl logs -n kube-system cloud-controller-manager
- Deploy demo examples
To setup cinder
with the out-tree
provider it is easiest to use the manifests
files that are provided as part of the upstream repository of the cloud-provider-openstack
.
-
Clone the repository or download a zip-file, extract it and cd into the root-folder of the project.
-
Adjust the manifest files for the
cinder-csi-plugin
for thenodecontroller
and thenodeplugin
:-
manifests/cinder-csi-plugin/cinder-csi-controllerplugin.yaml
-
manifests/cinder-csi-plugin/cinder-csi-nodeplugin.yaml
Add the
/etc/ssl/certs/SUSE_Trust_Root.pem
certificate to thecinder-csi-plugin
plugin container in both files:- name: cinder-csi-plugin # -- OMITTED -- volumeMounts: # -- OMITTED -- - name: suse-ca mountPath: /etc/ssl/certs/SUSE_Trust_Root.pem readOnly: true volumes: # -- OMITTED -- - name: kubelet-dir hostPath: path: /var/lib/kubelet type: Directory
-
-
Remove the
secret
configuration file from themanifests
(thesecret
has already been created):
rm manifests/cinder-csi-plugin/csi-secret-cinderplugin.yam
- Apply the
manifests/cinder-csi-plugin/
folder:
kubectl -f manifests/cinder-csi-plugin apply
- Deploy the example
nginx
application that is using aPersistentVolumeClaim
:
kubectl -f examples/cinder-csi-plugin/nginx.yaml create
- Verify the
PVC
is bound:
kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
csi-pvc-cinderplugin Bound pvc-39e361a7-4bbe-4252-ba73-fb7ab01cea02 1Gi RWO csi-sc-cinderplugin 4s