A Test Nginx Pod with PV

Create an Nginx Pod

cat << EOF | kubectl apply -f -
apiVersion: v1
kind: Namespace
metadata:
name: test-nginx
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: ceph-ext
labels:
app: nginx
namespace: test-nginx
spec:
storageClassName: rook-block
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
---
apiVersion: v1
kind: Pod
metadata:
name: nginx-test
namespace: test-nginx
labels:
app: nginx
spec:
volumes:
- name: mystorage
persistentVolumeClaim:
claimName: ceph-ext
containers:
- name: task-pv-container
image: nginx
ports:
- containerPort: 80
name: "http-server"
volumeMounts:
- mountPath: "/usr/share/nginx/html"
name: mystorage
---
apiVersion: v1
kind: Service
metadata:
name: nginx
labels:
app: nginx
spec:
ports:
- port: 80
name: web
clusterIP: None
selector:
app: nginx
---
EOF

Add some random data

[root@green--1 velero]# k -n test-nginx exec -it nginx-test -- /bin/bash # Adding 500 Mbcd  /usr/share/nginx/htmlroot@nginx-test:/usr/share/nginx/html# dd if=/dev/urandom of=/usr/share/nginx/html/test-file2.txt count=512000 bs=1024root@nginx-test:/usr/share/nginx/html# echo -n "my test " >> /usr/share/nginx/html/index.html ; done

Test it in the container

k -n test2-nginx exec -it nginx-test -- /bin/bash
root@nginx-test:/# curl localhost
hellow world

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store