Created
January 28, 2021 01:42
-
-
Save Buccaneersdan/be344247eee213e44543c5b41907852e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ============================================== | |
# Install cert-manager with a self-signed-issuer | |
# In response to the medium-article of Loïc Fache | |
# about how to install k3s+traefic2: | |
# https://medium.com/@fache.loic/k3s-traefik-2-9b4646393a1c | |
# ============================================== | |
# ------------------------------------------------- | |
# I was so bold to collect the below commands from | |
# Matthias Ludwigs blog entry on hetzner-community: | |
# https://community.hetzner.com/tutorials/howto-k8s-traefik-certmanager | |
# Replace all occurrences of ${DOMAIN} and ${VERSION} | |
# within it with the appropriate values. | |
# I used the version "v1.1.0" for ${VERSION} | |
# I changed Issuer to ClusterIssuer within | |
# the code from the hetzner-blog-entry | |
# ------------------------------------------------- | |
kubectl create namespace cert-manager | |
kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/${VERSION}/cert-manager.yaml | |
cat << EOF | kubectl apply -f - | |
apiVersion: cert-manager.io/v1alpha2 | |
kind: ClusterIssuer | |
metadata: | |
name: selfsigned | |
spec: | |
selfSigned: {} | |
--- | |
apiVersion: cert-manager.io/v1alpha2 | |
kind: Certificate | |
metadata: | |
name: ${DOMAIN}-cert | |
spec: | |
commonName: ${DOMAIN} | |
secretName: ${DOMAIN}-cert | |
dnsNames: | |
- ${DOMAIN} | |
issuerRef: | |
name: selfsigned | |
kind: ClusterIssuer | |
EOF | |
# ------------------------------------------------- | |
# The modified arguments for the Deployment- | |
# definition within the medium-article | |
# ------------------------------------------------- | |
- --accesslog | |
- --entryPoints.traefik.address=:9000 | |
- --entrypoints.web.Address=:80 | |
- --entrypoints.websecure.Address=:443 | |
- --providers.kubernetesIngress.ingressClass=traefik-cert-manager | |
- --api.dashboard=true | |
- --ping=true | |
- --providers.kubernetescrd | |
- --providers.kubernetesingress | |
# ------------------------------------------------- | |
# The modified IngressRoute from the medium-article | |
# ------------------------------------------------- | |
cat << EOF | kubectl apply -f - | |
apiVersion: traefik.containo.us/v1alpha1 | |
kind: IngressRoute | |
metadata: | |
name: ingressroutetls | |
annotations: | |
kubernetes.io/ingress.class: "traefik" | |
spec: | |
entryPoints: | |
- websecure | |
routes: | |
- match: Host(`${DOMAIN}`) | |
kind: Rule | |
services: | |
- name: MyTargetService | |
port: 8080 | |
tls: | |
secretName: ${DOMAIN}-cert |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment