Skip to content

Commit 5b797c7

Browse files
author
AC
committed
ceph
1 parent 9679d5b commit 5b797c7

File tree

6 files changed

+137
-6
lines changed

6 files changed

+137
-6
lines changed

kubernetes/storage/ceph/README.adoc

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ This section describes deploying Ceph storage on Kubernetes.
1212

1313
The following instructions and scripts were generated with information
1414
obtained from
15-
link:https://computingforgeeks.com/ceph-persistent-storage-for-kubernetes-with-cephfs/[computingforgeeks - Ceph Persistent Storage for Kubernetes with Cephfs]
16-
tutorial.
15+
link:https://computingforgeeks.com/ceph-persistent-storage-for-kubernetes-with-cephfs/[computingforgeeks - Ceph Persistent Storage for Kubernetes with Cephfs]
16+
and link:https://computingforgeeks.com/persistent-storage-for-kubernetes-with-ceph-rbd/[computingforgeeks - Persistent Storage for Kubernetes with Ceph RBD]
17+
tutorials.
1718

18-
== Configure
19+
== Collect information
1920

2021
Define environment variables.
2122

@@ -27,16 +28,22 @@ PROXMOX_HOST=<2>
2728
<1> Ceph Admin Key obtained with `ceph auth get-key client.admin` using root.
2829
<2> Ansible inventory hostname for a proxmox host.
2930

31+
== Configure Ceph RBD
32+
33+
TBD
34+
35+
== Configure Ceph OSD
36+
3037
[sourec,bash]
3138
----
32-
ansible-playbook kubernetes/storage/ceph/ansible/05-setup-cephfs.yaml \
39+
ansible-playbook kubernetes/storage/ceph/ansible/55-setup-cephfs.yaml \
3340
-e @kubernetes/storage/ceph/ansible/defaults/main.yaml \
3441
-e ceph_admin_key=${CEPH_ADM_KEY}
3542
----
3643

3744
[sourec,bash]
3845
----
39-
ansible-playbook kubernetes/storage/ceph/ansible/10-proxmox-create-cephfs-pool.yaml \
46+
ansible-playbook kubernetes/storage/ceph/ansible/60-proxmox-create-cephfs-pool.yaml \
4047
-e @kubernetes/storage/ceph/ansible/defaults/main.yaml \
4148
-e proxmox_host=${PROXMOX_HOST}
4249
----
@@ -47,7 +54,7 @@ Set the `ceph_monitors` variable with the list of Ceph Monitor information,
4754

4855
[sourec,bash]
4956
----
50-
ansible-playbook kubernetes/storage/ceph/ansible/20-setup-cephfs.yaml \
57+
ansible-playbook kubernetes/storage/ceph/ansible/65-setup-cephfs.yaml \
5158
-e @kubernetes/storage/ceph/ansible/defaults/main.yaml \
5259
-e @_local_config/network.yaml
5360
----
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
- name: "Create LVM DaemonSet"
3+
hosts: "{{ k8s_host | default('localhost') }}"
4+
gather_facts: "{{ gathering_host_info | default('true') | bool == true }}"
5+
6+
pre_tasks:
7+
8+
tasks:
9+
10+
- name: "Create application k8s namespace"
11+
kubernetes.core.k8s:
12+
src: files/ceph-rbd-provisioner.yml
13+
state: present
14+
15+
- name: "Create k8s secret with Ceph Admin key"
16+
ansible.builtin.shell: |
17+
kubectl create secret generic ceph-admin-secret \
18+
--type="kubernetes.io/rbd" \
19+
--from-literal=key='{{ ceph_admin_key }}' \
20+
--namespace=kube-system
21+
...
22+
File renamed without changes.

kubernetes/storage/ceph/ansible/10-proxmox-create-cephfs-pool.yaml renamed to kubernetes/storage/ceph/ansible/60-proxmox-create-cephfs-pool.yaml

File renamed without changes.
File renamed without changes.
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
kind: ServiceAccount
3+
apiVersion: v1
4+
metadata:
5+
name: rbd-provisioner
6+
namespace: kube-system
7+
---
8+
kind: ClusterRole
9+
apiVersion: rbac.authorization.k8s.io/v1
10+
metadata:
11+
name: rbd-provisioner
12+
namespace: kube-system
13+
rules:
14+
- apiGroups: [""]
15+
resources: ["persistentvolumes"]
16+
verbs: ["get", "list", "watch", "create", "delete"]
17+
- apiGroups: [""]
18+
resources: ["persistentvolumeclaims"]
19+
verbs: ["get", "list", "watch", "update"]
20+
- apiGroups: ["storage.k8s.io"]
21+
resources: ["storageclasses"]
22+
verbs: ["get", "list", "watch"]
23+
- apiGroups: [""]
24+
resources: ["events"]
25+
verbs: ["create", "update", "patch"]
26+
- apiGroups: [""]
27+
resources: ["services"]
28+
resourceNames: ["kube-dns","coredns"]
29+
verbs: ["list", "get"]
30+
- apiGroups: [""]
31+
resources: ["endpoints"]
32+
verbs: ["get", "list", "watch", "create", "update", "patch"]
33+
34+
---
35+
kind: ClusterRoleBinding
36+
apiVersion: rbac.authorization.k8s.io/v1
37+
metadata:
38+
name: rbd-provisioner
39+
namespace: kube-system
40+
subjects:
41+
- kind: ServiceAccount
42+
name: rbd-provisioner
43+
namespace: kube-system
44+
roleRef:
45+
kind: ClusterRole
46+
name: rbd-provisioner
47+
apiGroup: rbac.authorization.k8s.io
48+
49+
---
50+
apiVersion: rbac.authorization.k8s.io/v1
51+
kind: Role
52+
metadata:
53+
name: rbd-provisioner
54+
namespace: kube-system
55+
rules:
56+
- apiGroups: [""]
57+
resources: ["secrets"]
58+
verbs: ["get"]
59+
- apiGroups: [""]
60+
resources: ["endpoints"]
61+
verbs: ["get", "list", "watch", "create", "update", "patch"]
62+
63+
---
64+
apiVersion: rbac.authorization.k8s.io/v1
65+
kind: RoleBinding
66+
metadata:
67+
name: rbd-provisioner
68+
namespace: kube-system
69+
roleRef:
70+
apiGroup: rbac.authorization.k8s.io
71+
kind: Role
72+
name: rbd-provisioner
73+
subjects:
74+
- kind: ServiceAccount
75+
name: rbd-provisioner
76+
namespace: kube-system
77+
78+
---
79+
apiVersion: apps/v1
80+
kind: Deployment
81+
metadata:
82+
name: rbd-provisioner
83+
namespace: kube-system
84+
spec:
85+
replicas: 1
86+
selector:
87+
matchLabels:
88+
app: rbd-provisioner
89+
strategy:
90+
type: Recreate
91+
template:
92+
metadata:
93+
labels:
94+
app: rbd-provisioner
95+
spec:
96+
containers:
97+
- name: rbd-provisioner
98+
image: "quay.io/external_storage/rbd-provisioner:latest"
99+
env:
100+
- name: PROVISIONER_NAME
101+
value: ceph.com/rbd
102+
serviceAccount: rbd-provisioner

0 commit comments

Comments
 (0)