I have been in DevOps related jobs for past 6 years dealing mainly with Kubernetes in AWS and on-premise as well. I spent quite a lot …
:date_long | 1 min Read
Volumes
at file.yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: webapp
name: webapp
spec:
volumes:
- name: my-volume
hostPath:
path: /var/log/webapp
containers:
- image: kodekloud/event-simulator
name: webapp
resources: {}
volumeMounts:
- name: my-volume
mountPath: /log
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}
Storage classes
controlplane $ for i in `ls *.yaml`; do echo "---"; cat $i; done
---
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: nginx
name: nginx
spec:
volumes:
- name: from-pvc
persistentVolumeClaim:
claimName: local-pvc
containers:
- image: nginx:alpine
name: nginx
resources: {}
volumeMounts:
- name: from-pvc
mountPath: "/var/www/html"
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: local-pvc
spec:
storageClassName: local-storage
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 500Mi
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: delayed-volume-sc
provisioner: kubernetes.io/no-provisioner
parameters:
type: gp2
reclaimPolicy: Retain
allowVolumeExpansion: true
mountOptions:
- debug
volumeBindingMode: WaitForFirstConsumer