-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
How to expose the server at a subpath behind Kubernetes ingress in version 2 #975
Comments
@yuha0 I am against using a non-v1 Resource because non-v1 resources are not guranteed to be in most Kubernetes distributions. I don't think we can document this if that's the case due to the beta nature of the Ingress. However, I think we can document a LoadBalancer Resource instead. |
@sr229 Hi, I understand that beta API can change over time. But Ingress resources only have beta APIs ( IMHO, a LB example will help fewer users and the majority will not want to use a LB to expose code server: 1. Cloud providers charge users for each LB so it is very common to only have one LB pointing to a ingress controller. 2. LB is hard to setup in bare-metal environments. Anyway, I think I can rephrase my question because it does not necessarily have to be related to Kubernetes at all. It is just that Kubernetes happens to be my deployment environment. Could you help answer: How to expose code server version 2 at a subpath behind a reverse-proxy like NGINX? |
v2 allows you to set a base path, we documented in the CLI but I think we should document that. As for ingresses, I think we would document it but as much as possible I want to document v1 resources to prevent further hiccups later on doc-wise |
@yuha0 There's an example here using Nginx to host at a sub-path: https://github.com/cdr/code-server/blob/master/doc/quickstart.md#nginx-reverse-proxy. FYI the base path option is only used to redirect properly from the login page (if using password authentication) and to set the Let me know if that doesn't answer your question! |
Also the base path should only be the path so: |
dude, i could not find that example, it throws a 404 |
This is a very old issue and the docs have been changed. These days we recommend caddy. See https://github.com/cdr/code-server/blob/master/doc/guide.md |
thanks for the quick reply, so i ended up doing it with the ingress alone, just had to add the annotations nginx.ingress.kubernetes.io/rewrite-target, nginx.ingress.kubernetes.io/app-root and setting the path to /{subpath}(/|$)(.*) and it just worked like a charm. I'm using subpath because i'm launching instances on demand(programatically). Thanks again!! |
|
cc @bpmct |
@icaliman84 it's a regular ingress, for the path of the service i have "/somepath(/|$)(.*)" and these annotations : "nginx.ingress.kubernetes.io/rewrite-target: /$2" and "nginx.ingress.kubernetes.io/app-root: /somepath". this is all server side generated and this project is no longer running, that's why i did not provide a full ingress sample, if you have some time i can provision the environment and send you a full sample later!! |
@code-asher I cannot find the Is this feature removed now? Why? This is a very useful feature. |
It was removed because code-server uses relative paths now. In
other words, it should work no matter where you host it, without
having to manually specify the path.
If you are having problems there could be a bug in code-server, or
it could be a bug in your configuration. Feel free to open an
issue with details!
|
@code-asher I see. Thanks for explaining! |
Description
I am running the code server version 2 (docker image:
codercom/code-server:2.1472-vsc1.38.1
) in Kubernetes and need to access it at https://example.com/code, which is controlled by an Ingress Controller. I notice that there's a--base-path
option in the command line argument but it is not working for me.The Kubernetes manifest:
Related Issues
#241
The text was updated successfully, but these errors were encountered: