Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fresh install fails #12

Closed
tazhate opened this issue Apr 1, 2021 · 10 comments
Closed

fresh install fails #12

tazhate opened this issue Apr 1, 2021 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@tazhate
Copy link

tazhate commented Apr 1, 2021

I am using nginx-ingress in cluster in Digital Ocean.

Pods failed with:

/usr/local/bundle/gems/k8s-ruby-0.10.5/lib/k8s/api_client.rb:63:in `find_api_resource': Unknown resource ingresses for networking.k8s.io/v1 (K8s::Error::UndefinedResource)
	from /usr/local/bundle/gems/k8s-ruby-0.10.5/lib/k8s/api_client.rb:73:in `resource'
	from /app/src/main.rb:30:in `block in fetch_ingress_hosts'
	from /app/src/main.rb:28:in `map'
	from /app/src/main.rb:28:in `fetch_ingress_hosts'
	from /app/src/main.rb:62:in `check_and_rewrite_coredns'
	from /app/src/main.rb:134:in `block in main_loop'
	from /app/src/main.rb:132:in `loop'
	from /app/src/main.rb:132:in `main_loop'
	from /app/src/main.rb:144:in `<main>'

k8s version v1.18.8, nginx ingress is v0.40.2

@tazhate
Copy link
Author

tazhate commented Apr 1, 2021

looks like it is because ingress objects is still v1beta in 1.18. i think project should support old versions or have updated documentation.

@compumike compumike self-assigned this Apr 1, 2021
@compumike compumike added the bug Something isn't working label Apr 1, 2021
@compumike
Copy link
Owner

@tazhate Thanks for reporting this. I'll have a fix ready in a few hours.

@tazhate
Copy link
Author

tazhate commented Apr 1, 2021

@compumike oh nice! thanks!

@compumike
Copy link
Owner

@tazhate I believe this is fixed now and just pushed a new release v0.2.1. Can you try installing again (i.e. kubectl apply -f https://raw.githubusercontent.com/compumike/hairpin-proxy/v0.2.1/deploy.yml) and let me know if it works? Thanks!

@tazhate
Copy link
Author

tazhate commented Apr 1, 2021

@compumike now controller is running (so topic bug is fixed), but proxy fails to start.

[WARNING] 090/142245 (1) : config : missing timeouts for frontend 'fe_80'.
   | While not properly invalid, you will certainly encounter various problems
   | with such a configuration. To fix this, please ensure that all following
   | timeouts are set to a non-zero value: 'client', 'connect', 'server'.
[WARNING] 090/142245 (1) : config : missing timeouts for backend 'be_ingress_80'.
   | While not properly invalid, you will certainly encounter various problems
   | with such a configuration. To fix this, please ensure that all following
   | timeouts are set to a non-zero value: 'client', 'connect', 'server'.
[WARNING] 090/142245 (1) : config : missing timeouts for frontend 'fe_443'.
   | While not properly invalid, you will certainly encounter various problems
   | with such a configuration. To fix this, please ensure that all following
   | timeouts are set to a non-zero value: 'client', 'connect', 'server'.
[WARNING] 090/142245 (1) : config : missing timeouts for backend 'be_ingress_443'.
   | While not properly invalid, you will certainly encounter various problems
   | with such a configuration. To fix this, please ensure that all following
   | timeouts are set to a non-zero value: 'client', 'connect', 'server'.
[NOTICE] 090/142245 (1) : haproxy version is 2.3.9-53945bf
[ALERT] 090/142245 (1) : parsing [/usr/local/etc/haproxy/haproxy.cfg:7] : 'server my_server' : could not resolve address 'ingress-nginx-controller.ingress-nginx.svc.cluster.local'.
[ALERT] 090/142245 (1) : parsing [/usr/local/etc/haproxy/haproxy.cfg:16] : 'server my_server' : could not resolve address 'ingress-nginx-controller.ingress-nginx.svc.cluster.local'.
[ALERT] 090/142245 (1) : Failed to initialize server(s) addr.
➜  ~ k get svc -n ingress-nginx                                                                                                                                                                                                                         
NAME                                       TYPE           CLUSTER-IP       EXTERNAL-IP      PORT(S)                      AGE
nginx-ingress-nginx-controller             LoadBalancer   10.245.186.144   206.xx.xx.xx   80:30354/TCP,443:30200/TCP   163d
nginx-ingress-nginx-controller-admission   ClusterIP      10.245.43.77     <none>           443/TCP                      163d

@compumike
Copy link
Owner

OK. It looks like your service is named nginx-ingress-nginx-controller rather than the default ingress-nginx-controller so you're hitting the issue mentioned in Step 1 of the README, and you can update TARGET_SERVER to point to the correct one. Easy fix:

Run kubectl edit -n hairpin-proxy deployment hairpin-proxy-haproxy

Find the entry spec.template.spec.containers[0]. Right above resources: put this block in:

env:
  - name: TARGET_SERVER
    value: nginx-ingress-nginx-controller.ingress-nginx.svc.cluster.local

Make sure that the env: is aligned the same as resources:.

Out of curiosity, how did you install ingress-nginx to your cluster? I'd love to see if this alternate name is present in some documentation somewhere. Thanks.

@tazhate
Copy link
Author

tazhate commented Apr 1, 2021

@compumike thanks. now everything works like expected.

i think i've just copy-paste it from some tutorial like "nginx ingress via helm install" :) so different svc name is because of different helm release name.

@compumike
Copy link
Owner

Perfect. Glad to hear it!

@james-arawhanui
Copy link

james-arawhanui commented Mar 20, 2023

Necro-posting, hope this helps anyone that stumbles upon it.

I had a similar issue because I'd customized the service name during my helm install to company-ingress-nginx-controller but I must have skipped the additional step for changing the TARGET_SERVER because the readme states

If you're using ingress-nginx, this will work as-is.

And I was, I had just configured it with non-defaults 😅

It also turned out that I was using the default namespace (can't remember why, warn me if this is bad!), in the end my deployment's alteration ended up looking like this:

env:
  - name: TARGET_SERVER
    value: company-ingress-nginx-controller.default.svc.cluster.local
resources: # ...

Presto, no CrashLoopBackoff

@Vaskata84
Copy link

OK. It looks like your service is named nginx-ingress-nginx-controller rather than the default ingress-nginx-controller so you're hitting the issue mentioned in Step 1 of the README, and you can update TARGET_SERVER to point to the correct one. Easy fix:

Run kubectl edit -n hairpin-proxy deployment hairpin-proxy-haproxy

Find the entry spec.template.spec.containers[0]. Right above resources: put this block in:

env:
  - name: TARGET_SERVER
    value: nginx-ingress-nginx-controller.ingress-nginx.svc.cluster.local

Make sure that the env: is aligned the same as resources:.

Out of curiosity, how did you install ingress-nginx to your cluster? I'd love to see if this alternate name is present in some documentation somewhere. Thanks.

[2023-05-05T08:15:06.084436 #1] INFO -- : Polling all Ingress resources and CoreDNS configuration... │
│ W, [2023-05-05T08:15:06.087147 #1] WARN -- : Warning: Unable to list ingresses in extensions/v1beta1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants