Topics include Supply Chain Security, Vulnerability Management, Neat Tricks, and Contributor insights.
In part 3, of this series we used the GitOps Methodology to deploy the Cert Manager, NFS CSI Driver for Kubernetes to connect to the Synology NAS for centralised dynamic volume storage, Metallb Load Balancer, Traefik Proxy as the entrypoint for our Microservices and Ortelius the ultimate evidence store using Gimlet as the UI to our GitOps controller Fluxcd.
In part 4 we will setup Cloudflare, LetsEncrypt and Traefik to secure incoming requests with certificates.
You might know Cloudflare as a CDN but its so much more than that. Cloudflare is packed with amazing features and security offerings which are just to many to cover in this blog.
Cloudflare have kindly provided a free plan which we will use, so the first thing you need to do is set up an account for yourself or if you have an account login.
Websites
Add a site
register a new domain
Search for a domain name
box and find a domainmottles.com
was not available. She will not be impressedWebsites
you should see your new domain registeredpangarabbit.com
DNS
* is for wildcard
and the domain apex pangarabbit.com
SSL/TLS
nowFull (strict)
enabledHelp
buttonWhy isn’t my site working over HTTPS?
Certificate provisioning typically takes around 15 minutes for paid plans and up to 24 hours for Free plans. Contact support if you do not have a certificate after that time. If the certificate is already “active” under the Edge Certificates tab, but you still cannot access your site over HTTPS, refer to the troubleshooting documentation. What encryption mode should I use?
Cloudflare strongly recommends using Full or Full (strict) modes to prevent malicious connections to your origin. For details on each available mode, refer to the encryption modes documentation.
Edge Certificates
you will see that the kind folks at Cloudflare have provided you with a certificate for free also known as Universal SSL
Attention: Let’s Encrypt’s chain of trust will be changing on September 2024. Universal SSL certificates will be automatically switched to a more compatible certificate authority. Review our documentation for details and to understand the impacts on other certificate types.
Always Use HTTPS
Minimum TLS Version
to TLS 1.3
for the best securityOpportunistic Encryption
TLS 1.3
for the best securityAutomatic HTTPS Rewrites
Great we should have a functional certificate which will be auto renewed and we can use Traefik as the single point of entry for secure connections.
traefik.yaml
in the helm-releases
directory gitops-<your name>-infra
which was created by Gimlet and Fluxcd with the following changesENABLE
the certificate logic in /manifests/traefik-dynamic-config.yaml
and git push
and allow Flux to handle the deployment file:
# -- Create a file provider
enabled: true
# -- Allows Traefik to automatically watch for file changes
watch: true
# -- File content (YAML format, go template supported) (see https://doc.traefik.io/traefik/providers/file/)
# content:
providers:
file:
directory: /manifests/traefik-dynamic-config.yaml
The logic in the traefik-dynamic-config.yaml
would have created a secret
with your Cloudflare API token and a Issuer
for your certificate using Certificate Manager
Run the following to see your created certificate
kubectl get certificates -owide -n infrastructure
wildcard-pangarabbit-com
but we are are interested in the SECRET
ingressRoute
for the dashboard and you can see I only have websecure
enabled nowtls
configuration which matches SECRET
as in the above image ingressRoute:
dashboard:
# -- Create an IngressRoute for the dashboard
enabled: true
# -- Additional ingressRoute annotations (e.g. for kubernetes.io/ingress.class)
annotations: {}
# -- Additional ingressRoute labels (e.g. for filtering IngressRoute by custom labels)
labels: {}
# -- The router match rule used for the dashboard ingressRoute
matchRule: Host(`traefik.pangarabbit.com`) #PathPrefix(`/dashboard`) || PathPrefix(`/api`)
# -- Specify the allowed entrypoints to use for the dashboard ingress route, (e.g. traefik, web, websecure).
# By default, it's using traefik entrypoint, which is not exposed.
# /!\ Do not expose your dashboard without any protection over the internet /!\
entryPoints: ["websecure"]
# -- Additional ingressRoute middlewares (e.g. for authentication)
middlewares: []
# -- TLS options (e.g. secret containing certificate)
tls:
default:
defaultCertificate:
secretName: wildcard-pangarabbit-com-tls
healthcheck:
# -- Create an IngressRoute for the healthcheck probe
enabled: false
# -- Additional ingressRoute annotations (e.g. for kubernetes.io/ingress.class)
annotations: {}
# -- Additional ingressRoute labels (e.g. for filtering IngressRoute by custom labels)
labels: {}
# -- The router match rule used for the healthcheck ingressRoute
matchRule: PathPrefix(`/ping`)
# -- Specify the allowed entrypoints to use for the healthcheck ingress route, (e.g. traefik, web, websecure).
# By default, it's using traefik entrypoint, which is not exposed.
entryPoints: ["traefik"]
# -- Additional ingressRoute middlewares (e.g. for authentication)
middlewares: []
# -- TLS options (e.g. secret containing certificate)
tls: {}
Helm Release
and make your certifcate the default # -- TLS Store are created as [TLSStore CRDs](https://doc.traefik.io/traefik/https/tls/#default-certificate). This is useful if you want to set a default certificate. See EXAMPLE.md for details.
tlsStore:
default:
defaultCertificate:
secretName: wildcard-pangarabbit-com-tls
TLS
traefik.pangarabbit.com
(Access your dashboard at your domain name)All we have done now is secure the Traefik dashboard but how would we do it for other workloads. Lets look at a few examples.
k3d
type to make it Traefik awarems-nginx
microservice and gain access to the Ortelius backend ms-nginx:
ingress:
type: k3d # --set ms-nginx.ingress.type=k3d`
# This setting is for enabling the Traefik Class so that Traefik is made aware of Ortelius
# K3d https://k3d.io/v5.6.0/ is a lightweight Kubernetes deployment which uses Traefik as the default
dnsname: ortelius.pangarabbit.com # --set ms-nginx.ingress.dnsname=<your domain name goes here>
# The URL that will go in your browser to access the Ortelius frontend
ingressClassName
to make it Traefik aware and also enable TLS
# Argo CD server ingress configuration
ingress:
# -- Enable an ingress resource for the Argo CD server
enabled: true
# -- Specific implementation for ingress controller. One of `generic`, `aws` or `gke`
## Additional configuration might be required in related configuration sections
controller: generic
# -- Additional ingress labels
labels: {}
# -- Additional ingress annotations
## Ref: https://argo-cd.readthedocs.io/en/stable/operator-manual/ingress/#option-1-ssl-passthrough
annotations:
{}
# nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
# nginx.ingress.kubernetes.io/ssl-passthrough: "true"
# -- Defines which ingress controller will implement the resource
ingressClassName: "traefik"
# -- Argo CD server hostname
# @default -- `""` (defaults to global.domain)
hostname: "argocd.pangarabbit.com"
# -- The path to Argo CD server
path: /
# -- Ingress path type. One of `Exact`, `Prefix` or `ImplementationSpecific`
pathType: Prefix
# -- Enable TLS configuration for the hostname defined at `server.ingress.hostname`
## TLS certificate will be retrieved from a TLS secret `argocd-server-tls`
## You can create this secret via `certificate` or `certificateSecret` option
tls: true
FYI make sure you backup your persistent volumes on the NFS server
In Part 4 we configured a certificate for our domain using Cloudflare, LetsEncrypt and Traefik. From my experience the crucial configuration change for any workloads to access the frontend securely was to enable the ingress
, TLS
and to change the ingressClassName
to traefik
in the Helm Release values.
Happy alien hunting…….
How to Bake an Ortelius Pi | Part 5 | Ortelius Marries Jenkins