adamant-kite-43734
01/30/2025, 12:39 PMsparse-ghost-91718
01/30/2025, 9:17 PMsticky-summer-13450
01/31/2025, 4:36 PM/etc/rancher/rke2/rke2.yaml
from the node, edited the server URL in that file so that the file worked in for kubectl --kubeconfig harvester-rke2.yaml
, grabbed the already created cert and pushed it into the appropriate CRD.
This script is horrible, but shows you the CRD and the format of the expected data.
#!/bin/bash
set -e
publicCertificate=$(awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' ${CERTBOT_HOME}/etc/live/${DOMAIN}/fullchain.pem)
privateKey=$(awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' ${CERTBOT_HOME}/etc/live/${DOMAIN}/privkey.pem)
cat << EOF | kubectl apply -f - --kubeconfig harvester-rke2.yaml
apiVersion: harvesterhci.io/v1beta1
kind: Setting
metadata:
name: ssl-certificates
value: >-
{
"publicCertificate":"${publicCertificate}",
"privateKey":"${privateKey}"
}
EOF
I used that script for a while, but now I use kubectl kustomize
piped into envsubst
piped into kubectl apply
because that seems less hacky.