Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rbnis/gitops
https://github.com/rbnis/gitops
Last synced: 9 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/rbnis/gitops
- Owner: rbnis
- License: mit
- Created: 2022-08-21T13:42:46.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-24T20:06:35.000Z (13 days ago)
- Last Synced: 2024-10-25T07:42:52.829Z (12 days ago)
- Size: 877 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GitOps Repo
## Setup
### Set some variables
```bash
export CLUSTER_NAME=""
export GITHUB_TOKEN=""
export GITHUB_USER=""
```### Encryption
Here we will create two Age Private and Public keys. Using [SOPS](https://github.com/mozilla/sops) with [Age](https://github.com/FiloSottile/age) allows us to encrypt secrets and use them in Flux and work convieniently with them.
1. Create Age Keypairs.
```bash
mkdir -p "$HOME/.config/sops/age"
age-keygen -o "$HOME/.config/sops/age/keys.txt"
age-keygen -o "$HOME/.config/sops/age/cluster.keys.txt"
```2. Create `.sops.yaml` file.
```bash
export AGE_CLUSTER_PUBLIC_KEY="$(cat $HOME/.config/sops/age/cluster.keys.txt | awk '(NR==2)' | sed 's/.*: //')"
export AGE_PERSONAL_PUBLIC_KEY="$(cat $HOME/.config/sops/age/keys.txt | awk '(NR==2)' | sed 's/.*: //')"envsubst < ./.template/.sops.yaml > ./.sops.yaml
```3. Export the `SOPS_AGE_KEY_FILE` variable in your `bashrc`, `zshrc` or `config.fish` and source it.
```bash
echo 'export SOPS_AGE_KEY_FILE="$HOME/.config/sops/age/keys.txt"' >> "$HOME/.zshrc"
source "$HOME/.zshrc"
```4. Create a secret in the cluster to decrypt secrets.
```bash
kubectl create namespace flux-system
cat "$HOME/.config/sops/age/cluster.keys.txt" | kubectl create secret generic sops-age --namespace=flux-system --from-file=age.agekey=/dev/stdin
```### FluxCD
Bootstrap flux with:
```bash
flux bootstrap github \
--owner=$GITHUB_USER \
--repository= \
--branch=main \
--path=clusters/$CLUSTER_NAME \
--personal
```### Pre-Commit
```sh
pre-commit install-hooks
pre-commit install
```