-
Notifications
You must be signed in to change notification settings - Fork 0
Microk8s connects to microCeph
Rui Wang edited this page Oct 3, 2024
·
6 revisions
See: Connect existing MicroCeph cluster section in Set up Microk8s Kubernetes cluster and Rancher on NREC with Ansible.
- make sure the rbd kernel module is loaded
sudo modprobe rbd
- Enable rook-ceph
sudo microk8s enable rook-ceph
Then, we need to wait for pod rook-ceph-operator
in namespace rook-ceph
to be ready/active.
- Add rook-release repo
sudo microk8s helm3 repo add rook-release https://charts.rook.io/release
- Connect MicroK8s with any external Ceph cluster
sudo microk8s connect-external-ceph --ceph-conf /var/snap/microceph/current/conf/ceph.conf --keyring /var/snap/microceph/current/conf/ceph.keyring --rbd-pool microk8s-rbd
After running the command, it shows:
=================================================
Successfully imported external Ceph cluster. You can now use the following storageclass
to provision PersistentVolumes using Ceph CSI:
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
ceph-rbd rook-ceph.rbd.csi.ceph.com Delete Immediate true 1s
- testing
kubectl --namespace rook-ceph get pods -l "app=rook-ceph-operator"
kubectl --namespace rook-ceph-external get cephcluster
For testing:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: test-pvc
spec:
storageClassName: ceph-rbd
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: Pod
metadata:
name: test-pod
spec:
containers:
- name: test-container
image: nginx
volumeMounts:
- mountPath: "/var/lib/www/html"
name: vol
volumes:
- name: vol
persistentVolumeClaim:
claimName: test-pvc