INVESTIGATE: Secrets Management Consolidation
Status: Completed — PLAN-004 ready for implementation Created: 2025-01-23 Updated: 2026-02-19 — Added cleanup readiness audit Related to: PLAN-004-uis-orchestration-system
The investigation is complete with all design decisions made. The proposed
.uis.extend/and.uis.secrets/folder structure has been implemented as part of the UIS orchestration system. The cleanup audit (2026-02-19) confirmed all prerequisites are met — backwards compatibility code can now be safely removed. See PLAN-004-secrets-cleanup for the implementation plan.
Problem Statement
Secrets are currently scattered across multiple folders with inconsistent naming and unclear responsibilities. This makes it confusing for users and complicates container mounting.
Related Documentation
- Cloud-Init Documentation - Main cloud-init overview
- SSH Key Setup Guide - SSH key generation for Ansible
- Hosts Overview - All supported host types
Current State Analysis
Folder Structure
urbalurba-infrastructure/
├── .uis.extend/ # User config (committed to user's repo)
│ └── enabled-services.conf # Which services to deploy
│
├── topsecret/ # Main secrets folder (gitignored)
│ ├── secrets-templates/ # Base templates with ${VARIABLES}
│ ├── secrets-config/ # User-edited values (copied from templates)
│ ├── secrets-generated/ # Temp processing
│ ├── kubernetes/ # Generated K8s secrets YAML
│ ├── config/ # User config (enabled-services.conf)
│ ├── create-kubernetes-secrets.sh # Secret generation script
│ ├── copy-secrets2host.sh # Copy to provision-host
│ └── kubeconf-copy2local.sh # Kubeconfig management
│
├── secrets/ # SSH keys for Ansible (gitignored)
│ ├── id_rsa_ansible
│ ├── id_rsa_ansible.pub
│ └── create-secrets.sh
│
├── cloud-init/ # Cloud-init configuration
│ ├── *-cloud-init-template.yml # Templates (tracked in git)
│ ├── *-cloud-init.yml # Generated files (gitignored)
│ └── create-cloud-init.sh # Reads from topsecret & secrets
│
├── .uis.secrets/ # NEW - empty, created by uis wrapper
│
└── hosts/ # Host-specific scripts
├── azure-aks/
│ ├── *.sh # Setup/cleanup scripts
│ └── azure-aks-config.sh # Azure config (gitignored)
├── azure-microk8s/
│ ├── *.sh # Setup/cleanup scripts
│ └── azure-vm-config-*.sh # Azure VM config (gitignored)
├── multipass-microk8s/ # Scripts only (no config files)
├── rancher-kubernetes/ # Scripts only (no config files)
└── raspberry-microk8s/ # Scripts only (no config files)
Host Config Files (Scattered)
Config files in hosts/ contain sensitive Azure configuration:
hosts/azure-aks/azure-aks-config.sh: (gitignored)
TENANT_ID- Azure tenantSUBSCRIPTION_ID- Azure subscription- Resource group, cluster name, tags with email addresses
hosts/azure-microk8s/azure-vm-config-redcross-sandbox.sh: (gitignored)
- Same Azure IDs
- VM sizes, network config, disk settings
- Organization-specific naming conventions
Other host types (multipass, rancher, raspberry) currently have no separate config files - settings are hardcoded in scripts or use cloud-init.
Cloud-Init Dependencies
The cloud-init/create-cloud-init.sh script reads from:
../topsecret/kubernetes/kubernetes-secrets.yml- for secrets (tailscale, wifi, passwords)../secrets/id_rsa_ansible.pub- for SSH public key
Placeholders in templates:
URB_SSH_AUTHORIZED_KEY_VARIABLE- SSH public keyURB_TAILSCALE_SECRET_VARIABLE- Tailscale auth keyURB_WIFI_SSID_VARIABLE- WiFi network nameURB_WIFI_PASSWORD_VARIABLE- WiFi passwordURB_TEC_PASSWORD_VARIABLE- VM user passwordURB_TEC_USER_VARIABLE- VM username
Dependency Chain
The folders have a specific order of operations:
1. secrets/create-secrets.sh
└── Creates: id_rsa_ansible, id_rsa_ansible.pub
│
▼
2. cloud-init/create-cloud-init.sh
└── Reads: secrets/id_rsa_ansible.pub (SSH public key)
└── Reads: topsecret/kubernetes/kubernetes-secrets.yml (Tailscale key, etc.)
└── Creates: *-cloud-init.yml (with SSH key + Tailscale key embedded)
│
▼
3. VM Creation (Azure MicroK8s, GCP, AWS, Raspberry Pi)
└── Uses: cloud-init.yml to bootstrap VM
└── Injects: SSH public key for ansible user
└── Installs: Tailscale and auto-joins network
│
▼
4. VM is now reachable via Tailscale network
└── Cloud VMs have no public IP - Tailscale provides connectivity
└── Raspberry Pi on home network - also uses Tailscale
│
▼
5. Ansible Provisioning (via Tailscale)
└── Uses: secrets/id_rsa_ansible (private key)
└── Connects: to VM via Tailscale IP as ansible user
Key insight: For cloud VMs (Azure/GCP/AWS), Tailscale is required for network connectivity. The VM has no public IP - cloud-init sets up Tailscale so the VM auto-joins the network, then UIS can SSH to it.
Note: Managed services (Rancher Desktop, Azure AKS) do NOT use cloud-init - they have their own provisioning mechanisms.
Identified Problems
- Multiple locations: Secrets split across
topsecret/,secrets/,cloud-init/, andhosts/ - Confusing naming:
topsecret/contains both secrets AND config - Scripts mixed with data: Generation scripts in same folder as secrets
- Container mount complexity: Multiple folders need mounting
- Cloud-init generated files: Mixed with templates in same folder
- Cross-folder dependencies:
cloud-init/create-cloud-init.shreads from bothtopsecret/andsecrets/ - Host configs scattered: Azure config files in
hosts/azure-*/instead of central location - No single source of truth: User must edit multiple files in different locations
Proposed Structure
Two folders with clear purposes:
.uis.extend/ - Committed to user's repo
Non-sensitive configuration that users want to track in version control:
.uis.extend/
├── enabled-services.conf # Which services to deploy (already exists)
├── hosts/ # Kubernetes cluster configurations
│ ├── README.md # Explains the host types
│ │
│ ├── managed/ # Managed K8s services (provider handles infrastructure)
│ │ ├── personal-azure-aks.conf # My personal AKS cluster
│ │ ├── company-azure-aks.conf # Company AKS cluster
│ │ ├── client-gcp-gke.conf # Client's GKE cluster
│ │ └── ...
│ │
│ ├── cloud-vm/ # VMs in cloud running K8s
│ │ ├── dev-azure-microk8s.conf # Dev cluster on Azure
│ │ ├── prod-azure-talos.conf # Prod cluster with Talos
│ │ ├── test-gcp-microk8s.conf # Test cluster on GCP
│ │ └── ...
│ │
│ ├── physical/ # Physical devices running K8s