@ethelyn
To map a volume inside the ingress (nginx) pod in Minikube, you will need to follow these steps:
By following these steps, you will have a volume mapped inside the ingress (nginx) pod, which will be accessible through the configured <ingress-hostname>
and will serve files from the specified host path.
@ethelyn
1
|
minikube start |
1
|
minikube addons enable ingress |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: replicas: 1 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx ports: - containerPort: 80 volumeMounts: - mountPath: /usr/share/nginx/html name: html-volume volumes: - name: html-volume hostPath: path: /path/on/host/for/html |
Update the path field in the hostPath section with the desired directory path on the host machine.
1
|
kubectl apply -f nginx-deployment.yaml |
1 2 3 4 5 6 7 |
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: nginx-ingress spec: rules: - host: <ingress-hostname> |
1
|
kubectl apply -f nginx-ingress.yaml |
By following these steps, you will have a volume mapped inside the ingress (nginx) pod in Minikube.