Last active
July 20, 2020 17:57
-
-
Save CalvinHartwell/f54767780748025d898424d51f28e296 to your computer and use it in GitHub Desktop.
Microk8s + Charmed Ceph - Installation Steps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# This is a sample config map that helps define a Ceph cluster configuration | |
# as required by the CSI plugins. | |
apiVersion: v1 | |
kind: ConfigMap | |
# The <cluster-id> is used by the CSI plugin to uniquely identify and use a | |
# Ceph cluster, the value MUST match the value provided as `clusterID` in the | |
# StorageClass | |
# The <MONValue#> fields are the various monitor addresses for the Ceph cluster | |
# identified by the <cluster-id> | |
# If a CSI plugin is using more than one Ceph cluster, repeat the section for | |
# each such cluster in use. | |
# To add more clusters or edit MON addresses in an existing config map, use | |
# the `kubectl replace` command. | |
# NOTE: Changes to the config map is automatically updated in the running pods, | |
# thus restarting existing pods using the config map is NOT required on edits | |
# to the config map. | |
data: | |
config.json: |- | |
[ | |
{ | |
"clusterID": "e6436308-ca81-11ea-9846-00163e2eb71e", | |
"monitors": [ | |
"252.21.52.56:6789", | |
"252.45.25.20:6789", | |
"252.77.53.239:6789" | |
] | |
} | |
] | |
metadata: | |
name: ceph-csi-config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
series: bionic | |
applications: | |
ceph-osd: | |
charm: 'cs:ceph-osd' | |
num_units: 3 | |
annotations: | |
gui-x: '300' | |
gui-y: '300' | |
to: | |
- 0 | |
- 1 | |
- 2 | |
ceph-mon: | |
charm: 'cs:ceph-mon' | |
num_units: 3 | |
annotations: | |
gui-x: '600' | |
gui-y: '300' | |
to: | |
- lxd:0 | |
- lxd:1 | |
- lxd:2 | |
relations: | |
- - 'ceph-mon:osd' | |
- 'ceph-osd:mon' | |
machines: | |
"0": | |
"1": | |
"2": |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: v1 | |
kind: PersistentVolumeClaim | |
metadata: | |
name: rbd-pvc | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 1Gi | |
storageClassName: csi-rbd-sc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: v1 | |
kind: Secret | |
metadata: | |
name: ceph-rbd-secret | |
namespace: default | |
stringData: | |
# Key values correspond to a user name and its key, as defined in the | |
# ceph cluster. User ID should have required access to the 'pool' | |
# specified in the storage class | |
userID: admin | |
userKey: AQCsiRVfqXtlNxAAsbXJrMWJ9I7rbqaWb51XHA== | |
# Encryption passphrase | |
#encryptionPassphrase: test_passphrase |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
kind: Service | |
apiVersion: v1 | |
metadata: | |
name: csi-rbdplugin-provisioner | |
labels: | |
app: csi-metrics | |
spec: | |
selector: | |
app: csi-rbdplugin-provisioner | |
ports: | |
- name: http-metrics | |
port: 8080 | |
protocol: TCP | |
targetPort: 8680 | |
--- | |
kind: Deployment | |
apiVersion: apps/v1 | |
metadata: | |
name: csi-rbdplugin-provisioner | |
spec: | |
replicas: 3 | |
selector: | |
matchLabels: | |
app: csi-rbdplugin-provisioner | |
template: | |
metadata: | |
labels: | |
app: csi-rbdplugin-provisioner | |
spec: | |
serviceAccount: rbd-csi-provisioner | |
containers: | |
- name: csi-provisioner | |
image: quay.io/k8scsi/csi-provisioner:v1.6.0 | |
args: | |
- "--csi-address=$(ADDRESS)" | |
- "--v=5" | |
- "--timeout=150s" | |
- "--retry-interval-start=500ms" | |
- "--enable-leader-election=true" | |
- "--leader-election-type=leases" | |
- "--feature-gates=Topology=true" | |
env: | |
- name: ADDRESS | |
value: unix:///csi/csi-provisioner.sock | |
imagePullPolicy: "IfNotPresent" | |
volumeMounts: | |
- name: socket-dir | |
mountPath: /csi | |
- name: csi-snapshotter | |
image: quay.io/k8scsi/csi-snapshotter:v2.1.0 | |
args: | |
- "--csi-address=$(ADDRESS)" | |
- "--v=5" | |
- "--timeout=150s" | |
- "--leader-election=true" | |
env: | |
- name: ADDRESS | |
value: unix:///csi/csi-provisioner.sock | |
imagePullPolicy: "IfNotPresent" | |
securityContext: | |
privileged: true | |
volumeMounts: | |
- name: socket-dir | |
mountPath: /csi | |
- name: csi-attacher | |
image: quay.io/k8scsi/csi-attacher:v2.1.1 | |
args: | |
- "--v=5" | |
- "--csi-address=$(ADDRESS)" | |
- "--leader-election=true" | |
- "--retry-interval-start=500ms" | |
env: | |
- name: ADDRESS | |
value: /csi/csi-provisioner.sock | |
imagePullPolicy: "IfNotPresent" | |
volumeMounts: | |
- name: socket-dir | |
mountPath: /csi | |
- name: csi-resizer | |
image: quay.io/k8scsi/csi-resizer:v0.5.0 | |
args: | |
- "--csi-address=$(ADDRESS)" | |
- "--v=5" | |
- "--csiTimeout=150s" | |
- "--leader-election" | |
- "--retry-interval-start=500ms" | |
env: | |
- name: ADDRESS | |
value: unix:///csi/csi-provisioner.sock | |
imagePullPolicy: "IfNotPresent" | |
volumeMounts: | |
- name: socket-dir | |
mountPath: /csi | |
- name: csi-rbdplugin | |
securityContext: | |
privileged: true | |
capabilities: | |
add: ["SYS_ADMIN"] | |
# for stable functionality replace canary with latest release version | |
image: quay.io/cephcsi/cephcsi:canary | |
args: | |
- "--nodeid=$(NODE_ID)" | |
- "--type=rbd" | |
- "--controllerserver=true" | |
- "--endpoint=$(CSI_ENDPOINT)" | |
- "--v=5" | |
- "--drivername=rbd.csi.ceph.com" | |
- "--pidlimit=-1" | |
- "--rbdhardmaxclonedepth=8" | |
- "--rbdsoftmaxclonedepth=4" | |
env: | |
- name: POD_IP | |
valueFrom: | |
fieldRef: | |
fieldPath: status.podIP | |
- name: NODE_ID | |
valueFrom: | |
fieldRef: | |
fieldPath: spec.nodeName | |
- name: CSI_ENDPOINT | |
value: unix:///csi/csi-provisioner.sock | |
imagePullPolicy: "IfNotPresent" | |
volumeMounts: | |
- name: socket-dir | |
mountPath: /csi | |
- mountPath: /dev | |
name: host-dev | |
- mountPath: /sys | |
name: host-sys | |
- mountPath: /lib/modules | |
name: lib-modules | |
readOnly: true | |
- name: ceph-csi-config | |
mountPath: /etc/ceph-csi-config/ | |
# - name: ceph-csi-encryption-kms-config | |
#mountPath: /etc/ceph-csi-encryption-kms-config/ | |
- name: keys-tmp-dir | |
mountPath: /tmp/csi/keys | |
- name: liveness-prometheus | |
image: quay.io/cephcsi/cephcsi:canary | |
args: | |
- "--type=liveness" | |
- "--endpoint=$(CSI_ENDPOINT)" | |
- "--metricsport=8680" | |
- "--metricspath=/metrics" | |
- "--polltime=60s" | |
- "--timeout=3s" | |
env: | |
- name: CSI_ENDPOINT | |
value: unix:///csi/csi-provisioner.sock | |
- name: POD_IP | |
valueFrom: | |
fieldRef: | |
fieldPath: status.podIP | |
volumeMounts: | |
- name: socket-dir | |
mountPath: /csi | |
imagePullPolicy: "IfNotPresent" | |
volumes: | |
- name: host-dev | |
hostPath: | |
path: /dev | |
- name: host-sys | |
hostPath: | |
path: /sys | |
- name: lib-modules | |
hostPath: | |
path: /lib/modules | |
- name: socket-dir | |
emptyDir: { | |
medium: "Memory" | |
} | |
- name: ceph-csi-config | |
configMap: | |
name: ceph-csi-config | |
# - name: ceph-csi-encryption-kms-config | |
#configMap: | |
#name: ceph-csi-encryption-kms-config | |
- name: keys-tmp-dir | |
emptyDir: { | |
medium: "Memory" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
kind: DaemonSet | |
apiVersion: apps/v1 | |
metadata: | |
name: csi-rbdplugin | |
spec: | |
selector: | |
matchLabels: | |
app: csi-rbdplugin | |
template: | |
metadata: | |
labels: | |
app: csi-rbdplugin | |
spec: | |
serviceAccount: rbd-csi-nodeplugin | |
hostNetwork: true | |
hostPID: true | |
# to use e.g. Rook orchestrated cluster, and mons' FQDN is | |
# resolved through k8s service, set dns policy to cluster first | |
dnsPolicy: ClusterFirstWithHostNet | |
containers: | |
- name: driver-registrar | |
# This is necessary only for systems with SELinux, where | |
# non-privileged sidecar containers cannot access unix domain socket | |
# created by privileged CSI driver container. | |
securityContext: | |
privileged: true | |
image: quay.io/k8scsi/csi-node-driver-registrar:v1.3.0 | |
args: | |
- "--v=5" | |
- "--csi-address=/csi/csi.sock" | |
- "--kubelet-registration-path=/var/lib/kubelet/plugins/rbd.csi.ceph.com/csi.sock" | |
lifecycle: | |
preStop: | |
exec: | |
command: [ | |
"/bin/sh", "-c", | |
"rm -rf /registration/rbd.csi.ceph.com \ | |
/registration/rbd.csi.ceph.com-reg.sock" | |
] | |
env: | |
- name: KUBE_NODE_NAME | |
valueFrom: | |
fieldRef: | |
fieldPath: spec.nodeName | |
volumeMounts: | |
- name: socket-dir | |
mountPath: /csi | |
- name: registration-dir | |
mountPath: /registration | |
- name: csi-rbdplugin | |
securityContext: | |
privileged: true | |
capabilities: | |
add: ["SYS_ADMIN"] | |
allowPrivilegeEscalation: true | |
# for stable functionality replace canary with latest release version | |
image: quay.io/cephcsi/cephcsi:canary | |
args: | |
- "--nodeid=$(NODE_ID)" | |
- "--type=rbd" | |
- "--nodeserver=true" | |
- "--endpoint=$(CSI_ENDPOINT)" | |
- "--v=5" | |
- "--drivername=rbd.csi.ceph.com" | |
# If topology based provisioning is desired, configure required | |
# node labels representing the nodes topology domain | |
# and pass the label names below, for CSI to consume and advertize | |
# its equivalent topology domain | |
# - "--domainlabels=failure-domain/region,failure-domain/zone" | |
env: | |
- name: POD_IP | |
valueFrom: | |
fieldRef: | |
fieldPath: status.podIP | |
- name: NODE_ID | |
valueFrom: | |
fieldRef: | |
fieldPath: spec.nodeName | |
- name: CSI_ENDPOINT | |
value: unix:///csi/csi.sock | |
imagePullPolicy: "IfNotPresent" | |
volumeMounts: | |
- name: socket-dir | |
mountPath: /csi | |
- mountPath: /dev | |
name: host-dev | |
- mountPath: /sys | |
name: host-sys | |
- mountPath: /run/mount | |
name: host-mount | |
- mountPath: /lib/modules | |
name: lib-modules | |
readOnly: true | |
- name: ceph-csi-config | |
mountPath: /etc/ceph-csi-config/ | |
#- name: ceph-csi-encryption-kms-config | |
#mountPath: /etc/ceph-csi-encryption-kms-config/ | |
- name: plugin-dir | |
mountPath: /var/lib/kubelet/plugins | |
mountPropagation: "Bidirectional" | |
- name: mountpoint-dir | |
mountPath: /var/lib/kubelet/pods | |
mountPropagation: "Bidirectional" | |
- name: keys-tmp-dir | |
mountPath: /tmp/csi/keys | |
- name: liveness-prometheus | |
securityContext: | |
privileged: true | |
image: quay.io/cephcsi/cephcsi:canary | |
args: | |
- "--type=liveness" | |
- "--endpoint=$(CSI_ENDPOINT)" | |
- "--metricsport=8680" | |
- "--metricspath=/metrics" | |
- "--polltime=60s" | |
- "--timeout=3s" | |
env: | |
- name: CSI_ENDPOINT | |
value: unix:///csi/csi.sock | |
- name: POD_IP | |
valueFrom: | |
fieldRef: | |
fieldPath: status.podIP | |
volumeMounts: | |
- name: socket-dir | |
mountPath: /csi | |
imagePullPolicy: "IfNotPresent" | |
volumes: | |
- name: socket-dir | |
hostPath: | |
path: /var/lib/kubelet/plugins/rbd.csi.ceph.com | |
type: DirectoryOrCreate | |
- name: plugin-dir | |
hostPath: | |
path: /var/lib/kubelet/plugins | |
type: Directory | |
- name: mountpoint-dir | |
hostPath: | |
path: /var/lib/kubelet/pods | |
type: DirectoryOrCreate | |
- name: registration-dir | |
hostPath: | |
path: /var/lib/kubelet/plugins_registry/ | |
type: Directory | |
- name: host-dev | |
hostPath: | |
path: /dev | |
- name: host-sys | |
hostPath: | |
path: /sys | |
- name: host-mount | |
hostPath: | |
path: /run/mount | |
- name: lib-modules | |
hostPath: | |
path: /lib/modules | |
- name: ceph-csi-config | |
configMap: | |
name: ceph-csi-config | |
#- name: ceph-csi-encryption-kms-config | |
# configMap: | |
# name: ceph-csi-encryption-kms-config | |
- name: keys-tmp-dir | |
emptyDir: { | |
medium: "Memory" | |
} | |
--- | |
# This is a service to expose the liveness metrics | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: csi-metrics-rbdplugin | |
labels: | |
app: csi-metrics | |
spec: | |
ports: | |
- name: http-metrics | |
port: 8080 | |
protocol: TCP | |
targetPort: 8680 | |
selector: | |
app: csi-rbdplugin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: storage.k8s.io/v1 | |
kind: StorageClass | |
metadata: | |
name: csi-rbd-sc | |
provisioner: rbd.csi.ceph.com | |
# If topology based provisioning is desired, delayed provisioning of | |
# PV is required and is enabled using the following attribute | |
# volumeBindingMode: WaitForFirstConsumer | |
parameters: | |
# String representing a Ceph cluster to provision storage from. | |
# Should be unique across all Ceph clusters in use for provisioning, | |
# cannot be greater than 36 bytes in length, and should remain immutable for | |
# the lifetime of the StorageClass in use. | |
# Ensure to create an entry in the config map named ceph-csi-config, based on | |
# csi-config-map-sample.yaml, to accompany the string chosen to | |
# represent the Ceph cluster in clusterID below | |
clusterID: "e6436308-ca81-11ea-9846-00163e2eb71e" | |
# If you want to use erasure coded pool with RBD, you need to create | |
# two pools. one erasure coded and one replicated. | |
# You need to specify the replicated pool here in the `pool` parameter, it is | |
# used for the metadata of the images. | |
# The erasure coded pool must be set as the `dataPool` parameter below. | |
# dataPool: ec-data-pool | |
pool: rbd | |
# RBD image features, CSI creates image with image-format 2 | |
# CSI RBD currently supports only `layering` feature. | |
imageFeatures: layering | |
# The secrets have to contain Ceph credentials with required access | |
# to the 'pool'. | |
csi.storage.k8s.io/provisioner-secret-name: ceph-rbd-secret | |
csi.storage.k8s.io/provisioner-secret-namespace: default | |
csi.storage.k8s.io/controller-expand-secret-name: ceph-rbd-secret | |
csi.storage.k8s.io/controller-expand-secret-namespace: default | |
csi.storage.k8s.io/node-stage-secret-name: ceph-rbd-secret | |
csi.storage.k8s.io/node-stage-secret-namespace: default | |
# Specify the filesystem type of the volume. If not specified, | |
# csi-provisioner will set default as `ext4`. | |
csi.storage.k8s.io/fstype: ext4 | |
# uncomment the following to use rbd-nbd as mounter on supported nodes | |
# mounter: rbd-nbd | |
# Instruct the plugin it has to encrypt the volume | |
# By default it is disabled. Valid values are "true" or "false". | |
# A string is expected here, i.e. "true", not true. | |
# encrypted: "true" | |
# Use external key management system for encryption passphrases by specifying | |
# a unique ID matching KMS ConfigMap. The ID is only used for correlation to | |
# config map entry. | |
# encryptionKMSID: <kms-config-id> | |
# Add topology constrained pools configuration, if topology based pools | |
# are setup, and topology constrained provisioning is required. | |
# For further information read TODO<doc> | |
# topologyConstrainedPools: | | |
# [{"poolName":"pool0", | |
# "dataPool":"ec-pool0" # optional, erasure-coded pool for data | |
# "domainSegments":[ | |
# {"domainLabel":"region","value":"east"}, | |
# {"domainLabel":"zone","value":"zone1"}]}, | |
# {"poolName":"pool1", | |
# "dataPool":"ec-pool1" # optional, erasure-coded pool for data | |
# "domainSegments":[ | |
# {"domainLabel":"region","value":"east"}, | |
# {"domainLabel":"zone","value":"zone2"}]}, | |
# {"poolName":"pool2", | |
# "dataPool":"ec-pool2" # optional, erasure-coded pool for data | |
# "domainSegments":[ | |
# {"domainLabel":"region","value":"west"}, | |
# {"domainLabel":"zone","value":"zone1"}]} | |
# ] | |
reclaimPolicy: Delete | |
allowVolumeExpansion: true | |
mountOptions: | |
- discard |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment