apiVersion: apps/v1
kind: Deployment
metadata:
name: auth-depl
spec:
replicas: 1
selector:
matchLabels:
app: auth
template:
metadata:
labels:
app: auth
spec:
containers:
- name: auth
image: emotive44/auth
env:
- name: JWT_KEY
valueFrom:
secretKeyRef:
name: jwt-secret
key: JWT_KEY
---
apiVersion: v1
kind: Service
metadata:
name: auth-srv
spec:
type: NodePort
selector:
app: auth
ports:
- name: auth
protocol: TCP
port: 3000
targetPort: 3000
nodePort: 30000
This is my auth service and deployment.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-service
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/use-regex: 'true'
spec:
rules:
- host: myapp.com
http:
paths:
- path: /api/users/?(.*)
pathType: "Prefix"
backend:
service:
name: auth-srv
port:
number: 3000
That is my Ingress file.
When I run commnand: minikube start, the message, which I received is:
StartHost failed, but will try again: provision: get ssh host-port: get port 22 for "minikube": docker container inspect -f "'{{(index (index .NetworkSettings.Ports "22/tcp") 0).HostPort}}'" minikube: exit status 1
kubectl get ingress, returns:
NAME CLASS HOSTS ADDRESS PORTS AGE
ingress-service <none> myapp.com 192.168.49.2 80 106m
In my windows host file I add: 192.168.49.2 myapp.com
And if I try to open myapp.com in browser: There is no access to this site
curl myapp.com
curl: (7) Failed to connect to myapp.com port 80: Timed out
This is describe for my ingress:
Name: ingress-service
Namespace: default
Address: 192.168.49.2
Default backend: default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
Rules:
Host Path Backends
---- ---- --------
myapp.com
/api/users/?(.*) auth-srv:3000 (172.17.0.2:3000)
Annotations: kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/use-regex: true
What could be the problem?