pv.yaml
kind: PersistentVolume
apiVersion: v1
metadata:
name: hostpath
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/tmp/devopsschool"
$ kubectl create -f pv.yaml
$ kubectl get pv
pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pvchostpath
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
$ kubectl create -f pvc.yaml
$ kubectl get pvc
pod.yaml
kind: Pod
apiVersion: v1
metadata:
name: task-pv-pod
spec:
containers:
- name: task-pv-container
image: scmgalaxy/nginx-devopsschoolv1
ports:
- containerPort: 80
name: "http-server"
volumeMounts:
- mountPath: "/usr/share/nginx/html"
name: task-pv-storage
volumes:
- name: task-pv-storage
persistentVolumeClaim:
claimName: pvchostpath
$ kubectl create -f pod.yaml
$ kubectl get pods -o wide
$ vi /tmp/devopsschool/index.html
$ curl http://ip-add
Kubernetes Tutorials using EKS – Part 1 – Introduction and Architecture
Kubernetes Tutorials using EKS – Part 2 – Architecture with Master and worker
Kubernetes Tutorials using EKS – Part 3 – Architecture with POD – RC – Deploy – Service
Kubernetes Tutorials using EKS – Part 4 – Setup AWS EKS Clustor
Kubernetes Tutorials using EKS – Part 5 – Namespaces and PODs
Kubernetes Tutorials using EKS – Part 6 – ReplicationControllers and Deployment
Kubernetes Tutorials using EKS – Part 7 – Services
Kubernetes Tutorials using EKS – Part 8 – Volume
Kubernetes Tutorials using EKS – Part 9 – Volume
Kubernetes Tutorials using EKS – Part 10 – Helm and Networking
Latest posts by Rajesh Kumar (see all)
- Discover the Heart of India with Mera Apna Bihar - December 20, 2024
- Experience the Pulse of Bangalore with Bangalore Orbit - December 20, 2024
- Discover the City of Lakes with Bhopal Orbit - December 20, 2024