Skip to content

Instantly share code, notes, and snippets.

@brooksphilip
Last active March 14, 2024 20:49
Show Gist options
  • Save brooksphilip/4903e72820f5485b395c0c922d84f7e4 to your computer and use it in GitHub Desktop.
Save brooksphilip/4903e72820f5485b395c0c922d84f7e4 to your computer and use it in GitHub Desktop.
example_pvc

#Example

Create Volume Claim

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: nginx
spec:
  storageClassName: longhorn
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

Attach a workload to the PVC

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
        - name: nginx
        #   env:
        #     - name: TZ
        #       value: US/Eastern
        #     - name: PUID
        #       value: "0"
        #     - name: GUID
        #       value: "0"
          image: nginx
          imagePullPolicy: Always
          volumeMounts:
            - name: nginx
              mountPath: /config
      volumes:
        - name: nginx
          persistentVolumeClaim:
            claimName: nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment