Restrict Kubernetes volume to a single pod Restrict Kubernetes volume to a single pod kubernetes kubernetes

Restrict Kubernetes volume to a single pod


You can use Recreate Strategy in Deployment to do that. This will kill all the existing Pods before new ones are created. Ref: Kubernetes doc. So their will be some downtime because of that.

apiVersion: apps/v1kind: Deploymentmetadata:  name: scylla  labels:    app: myapp    role: scyllaspec:  replicas: 1  selector:    matchLabels:      app: myapp      role: scylla  strategy:    type: Recreate  template:    metadata:      labels:        app: myapp        role: scylla    spec:      containers:        - name: scylla          image: scylladb/scylla          imagePullPolicy: Always          volumeMounts:            - mountPath: /var/lib/scylla/data              name: scylladb      volumes:        - name: scylladb          hostPath:            path: /var/myapp/scylla/            type: DirectoryOrCreate