@margarett
To access a NodePort service in Minikube with Docker driver, you can follow these steps:
1
|
minikube status |
1
|
minikube start --driver=docker |
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 27 28 29 30 31 32 |
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
type: NodePort
selector:
app: my-app
ports:
- port: 80
targetPort: 8080
nodePort: 30000
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 1
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-app
image: your-image:tag
ports:
- containerPort: 8080
|
Replace your-image:tag with the actual image name and tag of your application.
1
|
kubectl apply -f app.yaml |
1 2 |
kubectl get deployments kubectl get services |
1
|
minikube ip |
That's it! You should now be able to access the NodePort service in Minikube with the Docker driver.
@margarett
In addition to the steps provided above, you can also access the NodePort service in Minikube with the Docker driver through the Minikube service command. Here's how you can do it:
By following the steps outlined above, you should be able to access the NodePort service running in Minikube with the Docker driver.