| runme |
|
|---|
my cluster
List all the available nur tasks.
This is the primary home of most develoment commands and will reveal commands not listed here.
nur --helpThe .envrc.example file documents many of the variables available
Create an environment config from the example
cp .envrc.example .envrcAllow the current environment config to be used.
For security, any change to the config must be explicitly whitelisted. Refer to direnv for mor information
direnv allowIf you already have an age key from another environment, copy it into place:
mkdir -p ~/.config/sops/age
cp /path/to/your/keys.txt ~/.config/sops/age/keys.txtCreate a private key for securing secrets
mkdir -p ~/.config/sops/age
age-keygen -o ~/.config/sops/age/keys.txtThis will fail if the file has already been created
This ensures all generated yaml is up to date on commit
nur apply-git-hooksThis assumes that you have placed the files tls.crt and tls.key at the root of the directory
All secrets are encrypted with that key
All secrets must live in the encrypted file secrets.enc.yaml at the project root. An unencrypted secrets.yaml file is never committed.
You can edit in place (no plaintext file on disk):
sops secrets.enc.yaml
# or: nur secrets editOr decrypt to a file, edit, then encrypt back (plaintext exists only while you edit):
nur secrets decrypt
# edit secrets.yaml, then:
nur secrets encryptTo create the encrypted file from scratch, produce a YAML file, encrypt it with sops, and save as secrets.enc.yaml; do not keep an unencrypted secrets.yaml in the repo or in normal use.
nur build and nur switch already wrap themselves with the decrypt-to-temp script. For any other command that needs secrets, run it via the wrapper, which sets DECRYPTED_SECRET_FILE for the duration of the command:
./scripts/with-decrypted-secrets.sh nix build .#nixidyEnvs.x86_64-linux.dev.activationPackage --impure --no-link --print-out-pathsThe script decrypts secrets.enc.yaml to a temporary file, sets DECRYPTED_SECRET_FILE, runs your command, then removes the temp file so no decrypted copy is left on disk.
https://argo-cd.readthedocs.io/en/stable/getting_started/
Register Argo Helm Repo
helm repo add argo https://argoproj.github.io/argo-helmCreate namespace for argocd
kubectl create namespace argocdLoad ArgoCD helm chart
export DOMAIN="argocd.dev.kronkltd.net"
cat <<EOF | jet -o yaml | helm upgrade argocd argo/argo-cd \
--install \
--namespace argocd \
--version 7.6.12 \
-f -
{:domain "${DOMAIN?}"
:configs {:params {"server.insecure" true}}
:server
{:ingress
{:annotations
{"cert-manager.io/cluster-issuer" "letsencrypt-prod"
"ingress.kubernetes.io/force-ssl-redirect" "true"}
:enabled true
:tls true
:hostname "${DOMAIN?}"}}}
EOFFetch the default argocd password. This will be used to log in the first time.
argocd admin initial-password -n argocdForward argocd interface ports.
Untill the main application installs the ingress controllers, the only way to access the argocd interface is by forwarding the ports.
kubectl port-forward svc/argocd-server -n argocd 8080:443Registers the 00-master Application with argocd.
This will kick off argo installing all the other resources.
nur argocd apply-masterCreate cluster issuer record.
This will cause any ingress with the appropriate annotations to obtain a certificate from letsencrypt
This must be done after the cert-manager crds have been installed
replace EMAIL with your email
# Set to an email that will receive certificate expiration notices.
export EMAIL="duck@kronkltd.net"
cat <<EOF | kubectl apply -f -
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-prod
spec:
acme:
server: https://acme-v02.api.letsencrypt.org/directory
email: ${EMAIL}
privateKeySecretRef:
name: letsencrypt-prod
solvers:
- http01:
ingress:
class: traefik
EOFRead argo workflow token from secret
echo "Bearer $(kubectl -n argo-workflows get secret duck.service-account-token -o=jsonpath='{.data.token}' | base64 --decode)"Compile Nixidy config to YAML manifests
nur switch