test pod and pvc for debugging
1 min readApr 26, 2024
test pod for debugging:
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-world-deployment
spec:
replicas: 1
selector:
matchLabels:
app: hello-world
template:
metadata:
labels:
app: hello-world
spec:
containers:
- name: hello-world-container
image: nginx:latest
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: hello-world-service
spec:
selector:
app: hello-world
ports:
- protocol: TCP
port: 80
targetPort: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: hello-world-ingress
spec:
rules:
- host: hello-world.${cluster_name}.${tld}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: hello-world-service
port:
number: 80
test pod with pvc
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-world-deployment
spec:
replicas: 1
selector:
matchLabels:
app: hello-world
template:
metadata:
labels:
app: hello-world
spec:
containers:
- name: hello-world-container
image: nginx:latest
ports:
- containerPort: 80
volumeMounts: # Mounting the volume to the container
- name: storage
mountPath: /usr/share/nginx/html # Example path where you want to mount your volume
volumes: # Declaring the volume in the pod specification
- name: storage
persistentVolumeClaim:
claimName: hello-world-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim # Definition for a PersistentVolumeClaim
metadata:
name: hello-world-pvc
spec:
accessModes:
- ReadWriteOnce # This PVC is mounted as read-write by a single node
resources:
requests:
storage: 1Gi # Requesting 1 GiB of space
---
apiVersion: v1
kind: Service
metadata:
name: hello-world-service
spec:
selector:
app: hello-world
ports:
- protocol: TCP
port: 80
targetPort: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: hello-world-ingress
spec:
rules:
- host: hello-world.${cluster_name}.${tld}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: hello-world-service
port:
number: 80