Skip to content

Instantly share code, notes, and snippets.

@mauilion

mauilion/README.md Secret

Last active May 14, 2020
Embed
What would you like to do?
resources for mauilion.dev/posts/kind-pvc-local

Resources for mauilion.dev/posts/kind-pvc-local

apiVersion: apps/v1
kind: Deployment
metadata:
name: hostpath
namespace: default
labels:
app: book
spec:
replicas: 1
selector:
matchLabels:
app: hostpath
template:
metadata:
labels:
app: hostpath
spec:
containers:
- name: name
image: gcr.io/google-containers/echoserver:1.10
volumeMounts:
- mountPath: /data
name: data
volumes:
- name: data
hostPath:
path: /tmp/data # this is the data on the underlying host!
apiVersion: apps/v1
kind: Deployment
metadata:
name: pvc
namespace: default
labels:
app: book
spec:
replicas: 1
selector:
matchLabels:
app: pvc
template:
metadata:
labels:
app: pvc
spec:
containers:
- name: name
image: gcr.io/google-containers/echoserver:1.10
volumeMounts:
- mountPath: /data
name: data
volumes:
- name: data
persistentVolumeClaim:
claimName: book
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
extraMounts:
- hostPath: ./data
containerPath: /tmp/data
- role: worker
extraMounts:
- hostPath: ./data
containerPath: /tmp/data
- role: worker
extraMounts:
- hostPath: ./data
containerPath: /tmp/data
apiVersion: v1
kind: PersistentVolume
metadata:
name: book
labels:
app: book
spec:
storageClassName: manual
capacity:
storage: 20Gi
accessModes:
- ReadWriteMany
claimRef: # the claimRef is here to provide a "connection" between this pv and the pvc.
apiVersion: v1
kind: PersistentVolumeClaim
name: book
namespace: default
hostPath:
path: /tmp/data/
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: book
namespace: default
labels:
app: book
spec:
storageClassName: manual
accessModes:
- ReadWriteMany
resources:
requests:
# The amount of the volume's storage to request
storage: 20Gi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.