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

HTTPS/TLS/SSL provider ingress support #3

Open
arno01 opened this issue Jan 13, 2022 · 12 comments
Open

HTTPS/TLS/SSL provider ingress support #3

arno01 opened this issue Jan 13, 2022 · 12 comments
Labels
repo/provider Akash provider-services repo issues

Comments

@arno01
Copy link

arno01 commented Jan 13, 2022

Is your feature request related to a problem? Please describe.
People have to use 3rd party services for terminating HTTPS (TLS/SSL), i.e. CloudFlare.
Le'ts add the HTTPS support so to make Akash more decentralized! :-)

Describe the solution you'd like
There is a cert-manager for Kubernetes which supports multiple issuers, including ACME (Let's Encrypt supported!)

So it'd be cool if Akash could support that!

All that it would need is to support setting the correct annotation to the "Ingress" type of K8s resource:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt

letsencrypt is just an arbitrary name, it could be anything there.

Cluster Issuer can be configured by the Akash provider admin.
In my case I've configured it as letsencrypt:

$ kubectl get ClusterIssuers
NAME               READY   AGE
letsencrypt   True    301d

And here are the instructions on how to configure a basic ACME issuer (I am using that) => https://cert-manager.io/docs/configuration/acme/#creating-a-basic-acme-issuer
The instructions are for Staging Let's Encrypt.
So to use the Production Let's Encrypt, just change https://acme-staging-v02.api.letsencrypt.org/directory to https://acme-v02.api.letsencrypt.org/directory :-)
But it's always good to test the staging one, to make sure it is working (i.e. creating the secrets with the keys there) so to not hit the LE's rate limits.

I would see the cert manager cluster-issuer name could be configured via Akash provider's argument, in the same way we can specify the deployment runtime as of now:

$ akash provider run --help |grep runt
      --deployment-runtime-class string             kubernetes runtime class for deployments, use none for no specification (default "gvisor")
@arno01
Copy link
Author

arno01 commented Jan 13, 2022

And then, the users may specify which services need TLS, via expose.to https://docs.akash.network/intro-to-akash/stack-definition-language#services.expose

@boz
Copy link

boz commented Jan 19, 2022

Thanks @arno01 - this is something we've been meaning to get to for a while but haven't had a chance to. This helps a lot.

@tmcdonough
Copy link

Would also find this useful

@cloud-j-luna
Copy link
Member

@arno01 @boz Would a feature such as allowing the ingress controller to proxy the requests to the Pods so that we could do the TLS termination in the server such as nginx?

Something that looks like:

services:
  website:
    expose:
      - port: 80
        https_options:
          redirect: true # Proxy requests to the Pod by ignoring the TLS termination

These annotations could be used on the ingresses to achieve this.

nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"

Would such an implementation work with Akash?

Given how it is really limiting to use third-party solutions such as Cloudflare, having this as an intermediate solution, while cert-manager is not working on the Akash providers, would be a great enabler. IMO this should move higher in priority and not left behind. I would gladly work on this feature. Let me know what you think. 😄

@boz
Copy link

boz commented Dec 23, 2022

This would be great!

Last time I looked into this there were prohibitive limits on the number of domains that a single LE account could make certs for, but it looks like those constraints have been relaxed.

Would love to have this be available!

@andy108369
Copy link
Contributor

@cloud-j-luna that's awesome, I'll be glad to test your PR. :-)
The right provider repo is here https://github.com/ovrclk/provider-services/

@andy108369 andy108369 transferred this issue from akash-network/node Jan 20, 2023
@andy108369
Copy link
Contributor

andy108369 commented Jan 20, 2023

Related #2

@andy108369 andy108369 reopened this Jan 20, 2023
@andy108369 andy108369 added the repo/provider Akash provider-services repo issues label Jan 23, 2023
@cloud-j-luna
Copy link
Member

Once this has green light we can start working on it as we also work on #2 (although they are different PRs, they are related and in the scope of our tasks/needs). 😄

@cloud-j-luna
Copy link
Member

PRs related to cert-manager enablement:
akash-network/provider#86
akash-network/helm-charts#196

Currently only ClusterIssuer is enabled, so every deployment shares the same issuer, which by default is letsencrypt.
I would like to open the discussion on the per-deployment issuers. (Maybe on the next SIG-Providers)

CC @boz @arno01

@boz
Copy link

boz commented Feb 22, 2023

Love it!

This is a great milestone, we can and should look into per-deployment issuers (support custom hostnames) after this.

@andy108369
Copy link
Contributor

I've enabled the TLS certs out-of-the-box in our sandbox provider, feel free to test it.

@akash-network akash-network deleted a comment from cloud-j-luna Apr 26, 2023
@arno01
Copy link
Author

arno01 commented Aug 25, 2023

@troian tenants can have Let's Encrypt certs out-of-the-box without the need of passing their x509 certs/keys nor tokens (since no DNS-01 ACME challenge is used, but only HTTP-01 ;)). All they need is to just point their domain to the IP or CNAME of the worker node of the cluster and make sure their SDL contains the domain of their choice under accept: field.

Please see Extra: certs for custom DNS names section in this gist to learn what it takes for the Akash to enable this feature.

Pod needs to specify cert-manager.io/cluster-issuer ingress annotation and add spec.tls bit (just the name & secretName without actual x509 secret bits at all; cert-manager will take care of that by itself once it sees the correct annotation and spec.tls bits in the deployment's ingress).

On the provider side it only requires the following:

  1. installing the cert-manager;
  2. configuring the HTTP-01 issuer; (basically first two steps from this gist until the DNS-01 part; unless providers wanting to have *.ingress.<provider-domain> or *.<provider-domain> signed out-of-the-box as well (the latter is currently enabled in the sandbox provider-02 and provider.akash.pro mainnet5)

Ideally, the providers should be also adding some attribute, probably tls: true to indicate the TLS support.
Possibly even the solvers too (http-01, dns-01, ...) to be complete.
The documentation will state that http-01 solver is used for the custom domains and dns-01 for the provider's ingresses (aka uri's).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
repo/provider Akash provider-services repo issues
Projects
None yet
Development

No branches or pull requests

5 participants