### Example of Migrated Resources Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/upgrade/migration/2-collect-information/index.html This snippet shows an example of the resources that will be saved to `v2-resources.yaml` after the upgrade, including cluster configuration. ```yaml apiVersion: piraeus.io/v1 kind: LinstorCluster metadata: name: linstorcluster spec: linstorPassphraseSecret: piraeus-passphrase patches: [] ... ``` -------------------------------- ### Example Output of Data Collection Script Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/upgrade/migration/2-collect-information/index.html This is an example of the output you might see from the data collection script, showing resource differences and prompts for confirmation. ```diff Using kubectl context: kubernetes-admin@kubernetes Found LinstorControllers: ["piraeus-cs"] Found LinstorSatelliteSets: ["piraeus-ns"] Found LinstorCSIDrivers: ["piraeus"] Found additional environment variables passed to LINSTOR Controller -- Default resource +++ Updated resource @@ -143,6 +143,12 @@ kind: Deployment - args: - startController env: + - name: FOO + value: bar + - name: EXAMPLE + valueFrom: + fieldRef: + fieldPath: status.podIP - name: JAVA_OPTS value: -Djdk.tls.acknowledgeCloseNotify=true - name: K8S_AWAIT_ELECTION_ENABLED Apply the patch (Y/n)? y ... ``` -------------------------------- ### Install Piraeus Operator Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/tutorial/get-started/index.html Use this command to install the Piraeus Operator using its Kustomization manifest. The operator will be installed in the 'piraeus-datastore' namespace. ```bash kubectl apply --server-side -f "https://github.com/piraeusdatastore/piraeus-operator/releases/latest/download/manifest.yaml" ``` -------------------------------- ### Configure Satellite Pod Template Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/reference/linstorsatelliteconfiguration/index.html This example configures resource requests for the satellite pod and enables host networking. It is applied as a patch to the default resources. ```yaml apiVersion: piraeus.io/v1 kind: LinstorSatelliteConfiguration metadata: name: resource-and-host-network spec: podTemplate: spec: hostNetwork: true containers: - name: linstor-satellite resources: requests: cpu: 100m ``` -------------------------------- ### Clone Piraeus Operator and Install with Helm Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/upgrade/migration/4-install-operator-v2/index.html Clone the Piraeus Operator repository and install it using Helm, setting installCRDs to true to include necessary Custom Resource Definitions. ```bash $ git clone -b v2.3.0 https://github.com/piraeusdatastore/piraeus-operator.git $ cd piraeus-operator $ helm install piraeus-operator charts/piraeus --set installCRDs=true ``` -------------------------------- ### Install Kernel Headers on Ubuntu Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/how-to/install-kernel-headers/index.html Installs the specific kernel headers for the currently running kernel on Ubuntu using apt. It's recommended to also install the 'linux-headers-virtual' package to ensure headers are updated with kernel upgrades. ```bash $ sudo apt-get update $ sudo apt-get install -y linux-headers-$(uname -r) ``` -------------------------------- ### LINSTOR Controller Container Configuration Example Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/explanation/image-configuration/index.html Illustrates how the LINSTOR Controller deployment references its container image, which is dynamically replaced by the Piraeus Operator based on the image configuration. ```yaml # ... containers: - name: linstor-controller # will be replaced with: # image: quay.io/piraeusdatastore/piraeus-server:v1.31.0 image: linstor-controller # ... ``` -------------------------------- ### Install Kernel Headers on Debian Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/how-to/install-kernel-headers/index.html Use apt to update package lists and install virtual kernel headers. This is a general command for Debian-based systems. ```bash $ sudo apt-get update $ sudo apt-get install -y linux-headers-virtual ``` -------------------------------- ### Check ktls-utils Container Logs Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/how-to/drbd-tls/index.html Verify that the ktls-utils container is running and has started successfully. ```bash $ kubectl logs -l app.kubernetes.io/component=linstor-satellite -c ktls-utils ``` -------------------------------- ### Install Kernel Headers for Architecture on Debian Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/how-to/install-kernel-headers/index.html Installs kernel headers for the system's architecture. This is useful for ensuring headers are available for upgrades. ```bash $ sudo apt-get update $ sudo apt-get install -y linux-headers-$(dpkg --print-architecture) ``` -------------------------------- ### Scale Up Deployment Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/tutorial/snapshots/index.html Increase the number of replicas for a deployment to one. This will start a new pod that will use the restored volume. ```bash $ kubectl scale deploy/volume-logger --replicas=1 deployment.apps/volume-logger scaled ``` -------------------------------- ### Install Linstor Cluster with Helm Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/how-to/helm/index.html Deploy the Piraeus Datastore Linstor cluster using the provided Helm chart. This command installs or upgrades the 'linstor-cluster' release in the 'piraeus-datastore' namespace. ```bash helm upgrade --install --namespace piraeus-datastore linstor-cluster oci://ghcr.io/piraeusdatastore/helm-charts/linstor-cluster ``` -------------------------------- ### Configure Satellite TLS with a Secret Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/reference/linstorsatelliteconfiguration/index.html This example demonstrates creating a manually provisioned TLS secret and referencing it in the LinstorSatelliteConfiguration to secure communication between LINSTOR Satellites and the Controller. The secret must contain `ca.crt`, `tls.crt`, and `tls.key`. ```yaml --- apiVersion: v1 kind: Secret metadata: name: my-node-tls namespace: piraeus-datastore data: ca.crt: LS0tLS1CRUdJT... tls.crt: LS0tLS1CRUdJT... tls.key: LS0tLS1CRUdJT... --- apiVersion: piraeus.io/v1 kind: LinstorSatelliteConfiguration metadata: name: satellite-tls spec: internalTLS: secretName: my-node-tls ``` -------------------------------- ### Check for Existing Kernel Headers Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/how-to/install-kernel-headers/index.html Run this command to verify if the kernel headers for the current running kernel are already installed. If 'found headers' is printed, no further action is needed. ```bash $ test -d /lib/modules/$(uname -r)/build/ && echo found headers ``` -------------------------------- ### Apply Patches to Satellite Configuration Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/reference/linstorsatelliteconfiguration/index.html This example configures the LINSTOR Satellite to use the "TRACE" log level for verbose output by patching the satellite-config ConfigMap. ```yaml apiVersion: piraeus.io/v1 kind: LinstorSatelliteConfiguration metadata: name: all-satellites spec: patches: - target: kind: ConfigMap name: satellite-config patch: |- apiVersion: v1 kind: ConfigMap metadata: name: satellite-config data: linstor_satellite.toml: | [logging] linstor_level = "TRACE" ``` -------------------------------- ### Configure LINSTOR Storage Pools Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/reference/linstorsatelliteconfiguration/index.html This example configures multiple LINSTOR Storage Pools, including LVM, LVM Thin, File System, File System Thin, ZFS, and ZFS Thin pools. It demonstrates specifying existing volume groups, thin pool configurations, creating pools from raw devices, and setting custom properties. ```yaml apiVersion: piraeus.io/v1 kind: LinstorSatelliteConfiguration metadata: name: storage-satellites spec: storagePools: - name: vg1 lvmPool: {} - name: vg1-thin lvmThinPool: volumeGroup: vg1 thinPool: thin - name: vg2-from-raw-devices lvmPool: volumeGroup: vg2 source: hostDevices: - /dev/sdb - /dev/sdc properties: - name: StorDriver/LvcreateOptions value: '-i 2' - name: fs1 filePool: {} - name: fs2 fileThinPool: directory: /mnt/data - name: zfs1 zfsPool: {} - name: zfs2 zfsThinPool: zPool: zfs-thin2 source: hostDevices: - /dev/sdd ``` -------------------------------- ### Install Kernel Development Packages for Upgrades on RHEL Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/how-to/install-kernel-headers/index.html Installs kernel-devel packages to ensure kernel headers are included during system upgrades on RHEL-based systems. ```bash $ sudo dnf install -y kernel-devel ``` -------------------------------- ### Install or Upgrade Piraeus Operator with Helm Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/how-to/helm/index.html Use this command to install or upgrade the Piraeus Operator in the 'piraeus-datastore' namespace. It ensures necessary CRDs are created and waits for the deployment to complete. ```bash helm upgrade --install --create-namespace --namespace piraeus-datastore piraeus-operator oci://ghcr.io/piraeusdatastore/piraeus-operator/piraeus --set installCRDs=true --wait ``` -------------------------------- ### Install LINSTOR Affinity Controller Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/how-to/linstor-affinity-controller/index.html Deploy the LINSTOR Affinity Controller using Helm after adding the repository. If deployed in the same namespace as the Piraeus Operator, connection parameters are usually auto-detected. ```bash helm install linstor-affinity-controller piraeus-charts/linstor-affinity-controller ``` -------------------------------- ### Upgrade Piraeus with Helm Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/upgrade/index.html Standard command to upgrade Piraeus using Helm. Ensure to pass any custom override options used during installation. ```bash helm upgrade piraeus-op ./charts/piraeus -f ``` -------------------------------- ### Add Piraeus Datastore Helm Repository Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/how-to/linstor-affinity-controller/index.html Run this command to add the Piraeus Datastore Helm chart repository to your Helm configuration. This makes the LINSTOR Affinity Controller chart available for installation. ```bash helm repo add piraeus-charts https://piraeus.io/helm-charts/ ``` -------------------------------- ### Apply Patches to LINSTOR Resources Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/reference/linstorcluster/index.html Applies custom patches to resources managed by the operator. This example sets a CPU limit for the CSI Node init container and configures the LINSTOR Controller service for SingleStack mode. Patches are applied as-is, so exercise caution. ```yaml apiVersion: piraeus.io/v1 kind: LinstorCluster metadata: name: linstorcluster spec: patches: - target: kind: Daemonset name: csi-node patch: |- - op: add path: /spec/template/spec/initContainers/0/resources value: limits: cpu: 10m - target: kind: Service name: linstor-controller patch: |- apiVersion: v1 kind: service metadata: name: linstor-controller spec: ipFamilyPolicy: SingleStack ``` -------------------------------- ### Configure LINSTOR Satellite Properties Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/reference/linstorsatelliteconfiguration/index.html This example demonstrates setting various properties on LINSTOR Satellites. It includes direct value assignment, inheriting from node labels and annotations, and expanding node labels into multiple properties. ```yaml apiVersion: piraeus.io/v1 kind: LinstorSatelliteConfiguration metadata: name: ipv6-nodes spec: properties: - name: PrefNic value: "default-ipv6" - name: Aux/example-property valueFrom: nodeFieldRef: metadata.labels['piraeus.io/example'] - name: AutoplaceTarget valueFrom: nodeFieldRef: metadata.annotations['piraeus.io/autoplace'] optional: yes - name: Aux/role/ expandFrom: nodeFieldRef: metadata.labels['node-role.kubernetes.io/*'] nameTemplate: "$1" valueTemplate: "$2" - name: Aux/features expandFrom: nodeFieldRef: metadata.labels['feature.example.com/*'] valueTemplate: "$1" delimiter: "," ``` -------------------------------- ### Install Kernel Development Packages on RHEL Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/how-to/install-kernel-headers/index.html Installs kernel-devel packages for Red Hat Enterprise Linux and compatible distributions using dnf. This command installs headers for the current kernel. ```bash $ sudo dnf install -y kernel-devel-$(uname -r) ``` -------------------------------- ### Import Certificate to Machine Owner Key (MOK) Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/how-to/secure-boot/index.html Enroll the generated certificate into the machine's trust store using `mokutil`. You will be prompted to enter and confirm a password. ```bash # mokutil --import signing_key.x509 input password: input password again: ``` -------------------------------- ### Download and Run Data Collection Script Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/upgrade/migration/2-collect-information/index.html Use this command to download and execute the script that collects information for the migration. It will prompt for confirmation on resource modifications. ```bash $ curl --proto '=https' --tlsv1.2 -sSf https://piraeus.io/docs/v2/how-to/upgrade/collect-operator-v1-information.sh | bash -s ``` -------------------------------- ### Verify Logged Data Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/tutorial/snapshots/index.html After creating the workload, wait for the Pod to become ready and then execute a command to view the logged data within the volume. ```bash $ kubectl wait pod --for=condition=Ready -l app.kubernetes.io/name=volume-logger pod/volume-logger-cbcd897b7-jrmks condition met ``` ```bash $ kubectl exec deploy/volume-logger -- cat /volume/hello ``` -------------------------------- ### Wait for Piraeus Datastore Pods to be Ready Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/tutorial/get-started/index.html This command waits for all Piraeus Datastore related pods, including the controller manager and CSI components, to be in a Ready state within the 'piraeus-datastore' namespace. ```bash kubectl wait pod --for=condition=Ready -n piraeus-datastore -l app.kubernetes.io/name=piraeus-datastore ``` -------------------------------- ### Create Deployment for Volume Consumer Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/tutorial/get-started/index.html Deploy a simple Nginx web server that mounts the 'data-volume' PersistentVolumeClaim at '/usr/share/nginx/html'. This Pod acts as the consumer needed to bind the PVC. ```yaml apiVersion: apps/v1 kind: Deployment metadata: name: web-server spec: selector: matchLabels: app.kubernetes.io/name: web-server template: metadata: labels: app.kubernetes.io/name: web-server spec: containers: - name: web-server image: nginx volumeMounts: - mountPath: /usr/share/nginx/html name: data volumes: - name: data persistentVolumeClaim: claimName: data-volume ``` -------------------------------- ### Import LINSTOR Database from Backup Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/upgrade/migration/1-migrate-database/index.html Use the linstor-database tool to import the database from a JSON backup file. This command should be executed within the migration pod. ```bash $ kubectl exec linstor-database-migration -- /usr/share/linstor-server/bin/linstor-database import-db -c /etc/linstor /backup/backup-before-migration.json ``` -------------------------------- ### Check Piraeus Operator Version Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/how-to/drbd-tls/index.html Verify the installed Piraeus Operator version. Requires Operator version >= 2.3.0. ```bash $ kubectl get pods -l app.kubernetes.io/component=piraeus-operator -ojsonpath='{.items[*].spec.containers[?(@.name=="manager")].image}{"\n"}' ``` -------------------------------- ### Verify Volume Mount in Pod Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/tutorial/get-started/index.html Check the filesystem within the running web server Pod to confirm that the volume is mounted at the expected path and shows available capacity. ```bash $ kubectl exec deploy/web-server -- df -h /usr/share/nginx/html Filesystem Size Used Avail Use% Mounted on /dev/drbd1000 973M 24K 906M 1% /usr/share/nginx/html ``` -------------------------------- ### Set LINSTOR Controller Properties Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/reference/linstorcluster/index.html Sets cluster-wide properties on the LINSTOR Controller. This example configures the port range for DRBD® volumes. ```yaml apiVersion: piraeus.io/v1 kind: LinstorCluster metadata: name: linstorcluster spec: properties: - name: TcpPortAutoRange value: "10000-20000" ``` -------------------------------- ### List Piraeus Datastore Pods and Components Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/explanation/components/index.html Use this kubectl command to list all running pods in your cluster and their corresponding Piraeus Datastore component labels. This helps in identifying and managing individual Piraeus components. ```bash $ kubectl get pods '-ocustom-columns=NAME:.metadata.name,COMPONENT:.metadata.labels.app\.kubernetes\.io/component' NAME COMPONENT ha-controller-vd82w ha-controller linstor-affinity-controller-c84cf8958-p5wjx linstor-affinity-controller linstor-controller-6c8f8dc47-cm8hr linstor-controller linstor-csi-controller-59b9968b86-ftl76 linstor-csi-controller linstor-csi-nfs-server-n64jv linstor-csi-nfs-server linstor-csi-node-hcmk9 linstor-csi-node linstor-satellite-k8s-10.test-66687 linstor-satellite piraeus-operator-controller-manager-6dcfcb4568-6jntp piraeus-operator piraeus-operator-gencert-59449cb449-nzg6z piraeus-operator-gencert ``` -------------------------------- ### Apply Kustomization and Rollout Status Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/upgrade/migration/4-install-operator-v2/index.html Apply the Kustomization configuration using kubectl and monitor the deployment's rollout status. ```bash $ kubectl apply -k . --server-side $ kubectl rollout status -n piraeus-datastore -w deploy/piraeus-operator-controller-manager ``` -------------------------------- ### Create StorageClass, PVC, and Deployment Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/tutorial/snapshots/index.html This snippet defines a StorageClass for Piraeus, a PersistentVolumeClaim, and a Deployment for a volume logger workload. Ensure your StorageClass name matches the PVC. ```yaml apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: piraeus-storage provisioner: linstor.csi.linbit.com allowVolumeExpansion: true volumeBindingMode: WaitForFirstConsumer parameters: linstor.csi.linbit.com/storagePool: pool1 --- aspiVersion: v1 kind: PersistentVolumeClaim metadata: name: data-volume spec: storageClassName: piraeus-storage resources: requests: storage: 1Gi accessModes: - ReadWriteOnce --- apiVersion: apps/v1 kind: Deployment metadata: name: volume-logger spec: selector: matchLabels: app.kubernetes.io/name: volume-logger strategy: type: Recreate template: metadata: labels: app.kubernetes.io/name: volume-logger spec: terminationGracePeriodSeconds: 0 containers: - name: volume-logger image: busybox args: - sh - -c - | echo "Hello from $HOSTNAME, running on $NODENAME, started at $(date)" >> /volume/hello # We use this to keep the Pod running tail -f /dev/null env: - name: NODENAME valueFrom: fieldRef: fieldPath: spec.nodeName volumeMounts: - mountPath: /volume name: data-volume volumes: - name: data-volume persistentVolumeClaim: claimName: data-volume ``` -------------------------------- ### Retrieve Helm-Generated LINSTOR Passphrase Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/upgrade/migration/2-collect-information/index.html Use this kubectl command to get the LINSTOR passphrase generated by Helm. This is crucial for migrating to Piraeus Operator v2. ```bash $ kubectl get secrets piraeus-op-passphrase -ogo-template='{{.data.MASTER_PASSPHRASE}}{"\n"}}' ZVRxanl1cVBscXV1ZTk1cmEwVTk5b0ptd0F4OGFmWlVPUVA0NWNnUw== ``` -------------------------------- ### Generate Key Material with OpenSSL Source: https://github.com/piraeusdatastore/docs/blob/gh-pages/v2.10.7/how-to/secure-boot/index.html Create a private key and a self-signed certificate for signing kernel modules. The certificate is valid for 10 years. ```bash $ openssl req -x509 -new -nodes -utf8 -sha256 -days 36500 -batch -outform DER \ -out signing_key.x509 -keyout signing_key.pem -config - <