Verify vault installation, for now vault is not initialized so pods are 0/1
kubectl exec vault-0 -- vault status
Key Value
--- -----
Seal Type shamir
Initialized false
Sealed true
Total Shares 0
Threshold 0
Unseal Progress 0/0
Unseal Nonce n/a
Version 1.18.1
Build Date 2024-10-29T14:21:31Z
Storage Type file
HA Enabled false
command terminated with exit code 2
Initialize vault
Note the root_token for the initial web ui login
Unseal vault
Repeat the same for the other vault-* pods if existing
Exec into the pod to initialize vault config, use root token from the vault keys file we generated
Enable kv-v2 engine
Create demo password
Verify secret retrieval
Create ingress for web access
Gitlab CI integration
Enable jwt
Download certificates from gitlab if are self signed
Generate jwt connection to gitlab
Create a policy to read secrets
Create demo role
Configure in gitlab CI variables
VAULT_SERVER_URL: http://vault-server:8200
VAULT_AUTH_ROLE: demo
Create the demo secret
Example gitlab pipeline
Output from the job
Policy template access secrets by gitlab group namespace
Get accessor name for jwt in vault, may need to install jq or can regex with grep, awk, etc
Create a policy pointing the accessor name and namespace_path
Role for the policy, note the claim mappings.
Create x number of project, subprojects and groups. Test if they can access their secrets within their namespace_name path.
Note subgroups can only access secrets within its subgroup path
kubectl exec vault-0 -- vault operator unseal $(cat cluster-keys.json | jq -r ".unseal_keys_b64[]")
Key Value
--- -----
Seal Type shamir
Initialized true
Sealed false
Total Shares 1
Threshold 1
Version 1.18.1
Build Date 2024-10-29T14:21:31Z
Storage Type file
Cluster Name vault-cluster-27427646
Cluster ID b4f4ad08-c258-93b4-c368-3b182ffab753
HA Enabled false