Closed DVGY closed 3 years ago
@DVGY: The label(s) triage/support
cannot be applied, because the repository doesn't have them
@DVGY please post the ingress definition.
From the screenshots, you should just use /api/users
and remove the use-regex
annotation
@DVGY please post the ingress definition.
From the screenshots, you should just use
/api/users
and remove theuse-regex
annotation
apiVersion: extensions/v1beta1
# apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-service
annotations:
kubernetes.io/ingress.class: ngnix
ngnix.ingress.kubernetes.io/use-regex: "true"
spec:
rules:
- host: ticketing.dev
http:
paths:
- path: /api/users/?(.*)
backend:
serviceName: auth-srv
servicePort: 3000
apiVersion: apps/v1
kind: Deployment
metadata:
name: auth-depl
spec:
replicas: 1 # tells how many pods to create
selector: # tells deployment how to find the pods it's going to create
matchLabels:
app: auth
template: # how to create the pods
metadata:
labels:
app: auth
spec:
containers:
- name: auth
image: dvgy/auth
---
apiVersion: v1
kind: Service
metadata:
name: auth-srv
spec:
selector:
app: auth
ports:
- name: auth
protocol: TCP
port: 3000
targetPort: 3000
apiVersion: skaffold/v2alpha3
kind: Config
deploy:
kubectl:
manifests:
- ./infra/k8s/*
build:
local:
push: false
artifacts:
- image: dvgy/auth
context: auth
docker:
dockerfile: Dockerfile
sync:
manual:
- src: "src/**/*.ts"
dest: .
@aledbf i am using /api/users/currentuser end point inside my index.ts file
You should use something like this:
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: ingress-service
annotations:
kubernetes.io/ingress.class: ngnix
spec:
rules:
- host: ticketing.dev
http:
paths:
- path: /api/users
backend:
serviceName: auth-srv
servicePort: 3000
/api/users
I still get a deprecated warning when I run
scaffold dev
I also get 404 Not found error
apiVersion: networking.k8s.io/v1beta1
# apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-service
annotations:
kubernetes.io/ingress.class: ngnix
# kubernetes.io/ingress.class: ngnix
# ngnix.ingress.kubernetes.io/use-regex: "true"
spec:
rules:
- host: ticketing.dev
http:
paths:
#- path: /api/users/?(.*)
- path: /api/users
backend:
serviceName: auth-srv
servicePort: 3000
I still get a deprecated warning when I run scaffold dev
That is expected. The warning disappears if you use networking.k8s.io/v1
but that requires a k8s v1.19 cluster.
Please post the ingress-nginx pod log
Just in case, your application is expecting /api/users right?
Just in case, your application is expecting /api/users right?
In my case my app in listening at /api/users/currentuser
, if i change my -path: /api/users
to - path: /api/users/currentuser
, still it is showing 404.
app.get("/api/users/currentuser", (req, res) => {
console.log("I am hit");
res.send("Hi there");
});
Ingress-ngnix Pod Log: I think there is no pod that runs ingress-service. I tried this command. I am using right command?
kubectl get pods
NAME READY STATUS RESTARTS AGE
auth-depl-797b7f9dcb-qnw8k 1/1 Running 0 16m
kubectl get pods -n ingress-service
No resources found in ingress-service namespace.
kubectl logs -f ingress-service
Error from server (NotFound): pods "ingress-service" not found
kubectl get pods -n ingress-nginx
No resources found in ingress-nginx namespace.
kubectl logs -f ingress-nginx
Error from server (NotFound): pods "ingress-nginx" not found
Is there any change that skaffold
is not applying kubectl apply
properly or there is something off
Is there any change that
skaffold
is not applyingkubectl apply
properly or there is something off
I cannot help you with that.
kubectl get pods -n ingress-nginx
This is strange. You should have pods running in the namespace. Are you sure you installed the ingress controller?
Going to route: https://ticketing.dev/api/users/currentuser give the error
Did you installed metallb or something else? There is no cloud balancer in bare-metal.
Did you installed metallb or something else? There is no cloud balancer in bare-metal. No, I used this command to install ingress-ngnix: kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.41.2/deploy/static/provider/cloud/deploy.yaml Website
This is strange. You should have pods running in the namespace. Are you sure you installed the ingress controller? Apart from the above command I did not installed ingress-nginx-controller seperately.
Is there any change that
skaffold
is not applyingkubectl apply
properly or there is something offI cannot help you with that.
kubectl get pods -n ingress-nginx
This is strange. You should have pods running in the namespace. Are you sure you installed the ingress controller?
Going to route: https://ticketing.dev/api/users/currentuser give the error
Did you installed metallb or something else? There is no cloud balancer in bare-metal.
Here is something I can see running as ingress-controller. Is this what you are talking about?
@aledbf kubectl krew install ingress-nginx
I ran this command, but then i deleted .krew folder
.
When i had this plugin installed, it was showing 404 error not found, since i have removed it, by deleting folder, it's still showing same 404.
@aledbf Found. I think pod is here. So today I started docker desktop and found these pods
Running cmd kubectl get pods -n ingress-nginx
Running cmd kubectl logs -n ingress-nginx ingress-nginx-controller-c4f944d4d-jb4pb
-------------------------------------------------------------------------------
NGINX Ingress controller
Release: v0.41.2
Build: d8a93551e6e5798fc4af3eb910cef62ecddc8938
Repository: https://github.com/kubernetes/ingress-nginx
nginx version: nginx/1.19.4
-------------------------------------------------------------------------------
I1209 15:36:14.264925 6 flags.go:205] "Watching for Ingress" class="nginx"
W1209 15:36:14.265414 6 flags.go:210] Ingresses with an empty class will also be processed by this Ingress controller
W1209 15:36:14.282961 6 client_config.go:608] Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work.
I1209 15:36:14.361776 6 main.go:241] "Creating API client" host="https://10.96.0.1:443"
I1209 15:36:14.729581 6 main.go:285] "Running in Kubernetes cluster" major="1" minor="19" git="v1.19.3" state="clean" commit="1e11e4a2108024935ecfcb2912226cedeafd99df" platform="linux/amd64"
I1209 15:36:16.133366 6 main.go:105] "SSL fake certificate created" file="/etc/ingress-controller/ssl/default-fake-certificate.pem"
I1209 15:36:16.136393 6 main.go:115] "Enabling new Ingress features available since Kubernetes v1.18"
W1209 15:36:16.146241 6 main.go:127] No IngressClass resource with name nginx found. Only annotation will be used.
I1209 15:36:16.612526 6 ssl.go:528] "loading tls certificate" path="/usr/local/certificates/cert" key="/usr/local/certificates/key"
I1209 15:36:16.800163 6 nginx.go:249] "Starting NGINX Ingress controller"
I1209 15:36:16.857108 6 event.go:282] Event(v1.ObjectReference{Kind:"ConfigMap", Namespace:"ingress-nginx", Name:"ingress-nginx-controller", UID:"3a9fee6c-798c-4d54-bd50-9ca5ebadaf50", APIVersion:"v1", ResourceVersion:"1906", FieldPath:""}): type: 'Normal' reason: 'CREATE' ConfigMap ingress-nginx/ingress-nginx-controller
I1209 15:36:18.026521 6 store.go:352] "Ignoring ingress" ingress="default/ingress-service" kubernetes.io/ingress.class="" ingressClassName=""
I1209 15:36:18.102456 6 nginx.go:291] "Starting NGINX process"
I1209 15:36:18.102594 6 leaderelection.go:243] attempting to acquire leader lease ingress-nginx/ingress-controller-leader-nginx...
I1209 15:36:18.104705 6 nginx.go:311] "Starting validation webhook" address=":8443" certPath="/usr/local/certificates/cert" keyPath="/usr/local/certificates/key"
I1209 15:36:18.151056 6 leaderelection.go:253] successfully acquired lease ingress-nginx/ingress-controller-leader-nginx
I1209 15:36:18.153091 6 status.go:84] "New leader elected" identity="ingress-nginx-controller-c4f944d4d-jb4pb"
I1209 15:36:18.157399 6 controller.go:144] "Configuration changes detected, backend reload required"
I1209 15:36:19.512505 6 controller.go:161] "Backend successfully reloaded"
I1209 15:36:19.512941 6 controller.go:172] "Initial sync, sleeping for 1 second"
I1209 15:36:19.513216 6 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-c4f944d4d-jb4pb", UID:"27e3172f-31bb-4c99-91a5-7276f2323473", APIVersion:"v1", ResourceVersion:"59700", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
E1209 15:44:17.780662 6 leaderelection.go:357] Failed to update lock: Put "https://10.96.0.1:443/api/v1/namespaces/ingress-nginx/configmaps/ingress-controller-leader-nginx": context deadline exceeded
I1209 15:44:17.781029 6 leaderelection.go:278] failed to renew lease ingress-nginx/ingress-controller-leader-nginx: timed out waiting for the condition
I1209 15:44:17.781509 6 leaderelection.go:243] attempting to acquire leader lease ingress-nginx/ingress-controller-leader-nginx...
I1209 15:44:20.437507 6 leaderelection.go:253] successfully acquired lease ingress-nginx/ingress-controller-leader-nginx
PS C:\Users\Gaurav Yadav\Documents\gitLocal\node with react microservice\ShopMe>
So this is logs after i ran skaffold dev, all of the above command i ran is before i ran skaffold dev
kubectl logs -n ingress-nginx ingress-nginx-controller-c4f944d4d-jb4pb
-------------------------------------------------------------------------------
NGINX Ingress controller
Release: v0.41.2
Build: d8a93551e6e5798fc4af3eb910cef62ecddc8938
Repository: https://github.com/kubernetes/ingress-nginx
nginx version: nginx/1.19.4
-------------------------------------------------------------------------------
I1209 15:36:14.264925 6 flags.go:205] "Watching for Ingress" class="nginx"
W1209 15:36:14.265414 6 flags.go:210] Ingresses with an empty class will also be processed by this Ingress controller
W1209 15:36:14.282961 6 client_config.go:608] Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work.
I1209 15:36:14.361776 6 main.go:241] "Creating API client" host="https://10.96.0.1:443"
I1209 15:36:14.729581 6 main.go:285] "Running in Kubernetes cluster" major="1" minor="19" git="v1.19.3" state="clean" commit="1e11e4a2108024935ecfcb2912226cedeafd99df" platform="linux/amd64"
I1209 15:36:16.133366 6 main.go:105] "SSL fake certificate created" file="/etc/ingress-controller/ssl/default-fake-certificate.pem"
I1209 15:36:16.136393 6 main.go:115] "Enabling new Ingress features available since Kubernetes v1.18"
W1209 15:36:16.146241 6 main.go:127] No IngressClass resource with name nginx found. Only annotation will be used.
I1209 15:36:16.612526 6 ssl.go:528] "loading tls certificate" path="/usr/local/certificates/cert" key="/usr/local/certificates/key"
I1209 15:36:16.800163 6 nginx.go:249] "Starting NGINX Ingress controller"
I1209 15:36:16.857108 6 event.go:282] Event(v1.ObjectReference{Kind:"ConfigMap", Namespace:"ingress-nginx", Name:"ingress-nginx-controller", UID:"3a9fee6c-798c-4d54-bd50-9ca5ebadaf50", APIVersion:"v1", ResourceVersion:"1906", FieldPath:""}): type: 'Normal' reason: 'CREATE' ConfigMap ingress-nginx/ingress-nginx-controller
I1209 15:36:18.026521 6 store.go:352] "Ignoring ingress" ingress="default/ingress-service" kubernetes.io/ingress.class="" ingressClassName=""
I1209 15:36:18.102456 6 nginx.go:291] "Starting NGINX process"
I1209 15:36:18.102594 6 leaderelection.go:243] attempting to acquire leader lease ingress-nginx/ingress-controller-leader-nginx...
I1209 15:36:18.104705 6 nginx.go:311] "Starting validation webhook" address=":8443" certPath="/usr/local/certificates/cert" keyPath="/usr/local/certificates/key"
I1209 15:36:18.151056 6 leaderelection.go:253] successfully acquired lease ingress-nginx/ingress-controller-leader-nginx
I1209 15:36:18.153091 6 status.go:84] "New leader elected" identity="ingress-nginx-controller-c4f944d4d-jb4pb"
I1209 15:36:18.157399 6 controller.go:144] "Configuration changes detected, backend reload required"
I1209 15:36:19.512505 6 controller.go:161] "Backend successfully reloaded"
I1209 15:36:19.512941 6 controller.go:172] "Initial sync, sleeping for 1 second"
I1209 15:36:19.513216 6 event.go:282] Event(v1.ObjectReference{Kind:"Pod", Namespace:"ingress-nginx", Name:"ingress-nginx-controller-c4f944d4d-jb4pb", UID:"27e3172f-31bb-4c99-91a5-7276f2323473", APIVersion:"v1", ResourceVersion:"59700", FieldPath:""}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
E1209 15:44:17.780662 6 leaderelection.go:357] Failed to update lock: Put "https://10.96.0.1:443/api/v1/namespaces/ingress-nginx/configmaps/ingress-controller-leader-nginx": context deadline exceeded
I1209 15:44:17.781029 6 leaderelection.go:278] failed to renew lease ingress-nginx/ingress-controller-leader-nginx: timed out waiting for the condition
I1209 15:44:17.781509 6 leaderelection.go:243] attempting to acquire leader lease ingress-nginx/ingress-controller-leader-nginx...
I1209 15:44:20.437507 6 leaderelection.go:253] successfully acquired lease ingress-nginx/ingress-controller-leader-nginx
192.168.65.3 - - [09/Dec/2020:16:08:35 +0000] "GET /api/users/currentuser HTTP/1.1" 400 650 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" 550 0.000 [] [] - - - - 4f8af15ceca151d0182ac60cae4e40a5
192.168.65.3 - - [09/Dec/2020:16:08:36 +0000] "GET /favicon.ico HTTP/1.1" 400 650 "http://127.0.0.1:443/api/users/currentuser" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" 461 0.000 [] [] - - - - b6cb325621c03502373cf653aceefa91
W1209 16:11:45.160120 6 controller.go:216] ignoring ingress ingress-service in default based on annotation kubernetes.io/ingress.class
I1209 16:11:45.160458 6 main.go:112] "successfully validated configuration, accepting" ingress="ingress-service/default"
PS C:\Users\Gaurav Yadav\Documents\gitLocal\node with react microservice\ShopMe>
Host OS: Windows 10. Docker version 19.03.13, build 4484c46d9d (WSL 2 Backend) kubectl version Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.3", GitCommit:"1e11e4a2108024935ecfcb2912226cedeafd99df", GitTreeState:"clean", BuildDate:"2020-10-14T12:50:19Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.3", GitCommit:"1e11e4a2108024935ecfcb2912226cedeafd99df", GitTreeState:"clean", BuildDate:"2020-10-14T12:41:49Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"linux/amd64"}
I ran this command: kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.41.2/deploy/static/provider/cloud/deploy.yaml
My Code Running
skaffold dev
cmdI have made change to my hosts file as
127.0.0.1 ticketing.dev
Going to route: https://ticketing.dev/api/users/currentuser give the error
ingress-srv.yaml
auth-depl.yaml
scaffold.yaml
Running
kubectl get svc --all-namespaces
andkubectl get ing
andkubectl describe ing ingress-service
cmdRunning
kubectl get pods
andkubectl get services
andkubectl get deployments
cmdCan you tell me what i am doing wrong, I tried port forwarding and installing the whole kubernetes again. But it did not worked for me.
If you need any information let me know
Thanks
/triage support