Kubernetes Deployment Guide
Prerequisites
- A Kubernetes cluster up and running.
kubectl
configured to interact with your cluster.
Installation Methods
Method 1: Using a Persistent Volume Claim
-
Create a Deployment Manifest
Save the following YAML as
magi-deployment.yaml
:apiVersion: apps/v1 kind: Deployment metadata: name: magi-deployment spec: replicas: 1 selector: matchLabels: app: magi template: metadata: labels: app: magi spec: containers: - name: magi image: alex-bruun/magi:latest volumeMounts: - mountPath: /data name: magi-data volumes: - name: magi-data persistentVolumeClaim: claimName: magi-pvc
-
Create a Persistent Volume Claim
Save the following YAML as
magi-pvc.yaml
: -
Apply the Manifests
Apply the Persistent Volume Claim and the Deployment manifest:
-
Verify Deployment
Check the status of the deployment:
Ensure that the pods are running and the volume is mounted correctly.
Method 2: Mounting a Host Path
-
Create a Deployment Manifest
Save the following YAML as
magi-deployment-hostpath.yaml
:apiVersion: apps/v1 kind: Deployment metadata: name: magi-deployment spec: replicas: 1 selector: matchLabels: app: magi template: metadata: labels: app: magi spec: containers: - name: magi image: alex-bruun/magi:latest volumeMounts: - mountPath: /data name: magi-data volumes: - name: magi-data hostPath: path: /path/on/host type: Directory
Replace
/path/on/host
with the actual path on the host machine that you want to mount inside the container. -
Apply the Manifest
Apply the deployment manifest:
-
Verify Deployment
Check the status of the deployment:
Ensure that the pods are running and the host path is mounted correctly.