feat: add first class support for private github repos (#1271)
Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
1 parent
95bf353f7e
commit
8ef31af331
9 files changed
+49
-93
No files matched your search
@@ -392,7 +392,7 @@ You have two different options for setting up your local workstation.
|
||||
|
||||
### 🔹 Stage 6: Install Flux in your cluster
|
||||
|
||||
> [!IMPORTANT]
|
||||
> [!NOTE]
|
||||
> Skip this stage if you have **disabled** Flux in the `config.yaml`
|
||||
|
||||
1. Verify Flux can be installed
|
||||
@@ -407,6 +407,9 @@ You have two different options for setting up your local workstation.
|
||||
|
||||
2. Install Flux and sync the cluster to the Git repository
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Run `task flux:github-deploy-key` first if using a private repository.
|
||||
|
||||
```sh
|
||||
task flux:bootstrap
|
||||
# namespace/flux-system configured
|
||||
@@ -579,95 +582,6 @@ To browse or get ideas on applications people are running, community member [@wh
|
||||
The included CSI (openebs in local-hostpath mode) is a great start for storage but soon you might find you need more features like replicated block storage, or to connect to a NFS/SMB/iSCSI server. If you need any of those features be sure to check out the projects like [rook-ceph](https://github.com/rook/rook), [longhorn](https://github.com/longhorn/longhorn), [openebs](https://github.com/openebs/openebs), [democratic-csi](https://github.com/democratic-csi/democratic-csi), [csi-driver-nfs](https://github.com/kubernetes-csi/csi-driver-nfs),
|
||||
and [synology-csi](https://github.com/SynologyOpenSource/synology-csi).
|
||||
|
||||
#### Authenticate Flux over SSH
|
||||
|
||||
<details>
|
||||
<summary><i>Click <b>here</b> to read guide on adding Flux SSH authentication</i></summary>
|
||||
|
||||
Authenticating Flux to your git repository has a couple benefits like using a private git repository and/or using the Flux [Image Automation Controllers](https://fluxcd.io/docs/components/image/).
|
||||
|
||||
By default this template only works on a public Github repository, it is advised to keep your repository public.
|
||||
|
||||
The benefits of a public repository include:
|
||||
|
||||
- Debugging or asking for help, you can provide a link to a resource you are having issues with.
|
||||
- Adding a topic to your repository of `kubesearch` to be included in the [Kubesearch](https://kubesearch.dev) results. This search helps people discover different configurations of Helm charts across others Flux based repositories.
|
||||
|
||||
1. Generate new SSH key:
|
||||
|
||||
```sh
|
||||
ssh-keygen -t ecdsa -b 521 -C "github-deploy-key" -f ./kubernetes/bootstrap/github-deploy.key -q -P ""
|
||||
```
|
||||
|
||||
2. Paste public key in the deploy keys section of your repository settings
|
||||
3. Create sops secret in `./kubernetes/bootstrap/github-deploy-key.sops.yaml` with the contents of:
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: github-deploy-key
|
||||
namespace: flux-system
|
||||
stringData:
|
||||
# 3a. Contents of github-deploy-key
|
||||
identity: |
|
||||
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||
...
|
||||
-----END OPENSSH PRIVATE KEY-----
|
||||
# 3b. Output of curl --silent https://api.github.com/meta | jq --raw-output '"github.com "+.ssh_keys[]'
|
||||
known_hosts: |
|
||||
github.com ssh-ed25519 ...
|
||||
github.com ecdsa-sha2-nistp256 ...
|
||||
github.com ssh-rsa ...
|
||||
```
|
||||
|
||||
4. Encrypt secret:
|
||||
|
||||
```sh
|
||||
sops --encrypt --in-place ./kubernetes/bootstrap/github-deploy-key.sops.yaml
|
||||
```
|
||||
|
||||
5. Apply secret to cluster:
|
||||
|
||||
```sh
|
||||
sops --decrypt ./kubernetes/bootstrap/github-deploy-key.sops.yaml | kubectl apply -f -
|
||||
```
|
||||
|
||||
6. Update `./kubernetes/flux/config/cluster.yaml`:
|
||||
|
||||
```yaml
|
||||
apiVersion: source.toolkit.fluxcd.io/v1beta2
|
||||
kind: GitRepository
|
||||
metadata:
|
||||
name: home-kubernetes
|
||||
namespace: flux-system
|
||||
spec:
|
||||
interval: 10m
|
||||
# 6a: Change this to your user and repo names
|
||||
url: ssh://git@github.com/$user/$repo
|
||||
ref:
|
||||
branch: main
|
||||
secretRef:
|
||||
name: github-deploy-key
|
||||
```
|
||||
|
||||
7. Commit and push changes
|
||||
8. Force flux to reconcile your changes
|
||||
|
||||
```sh
|
||||
flux reconcile -n flux-system kustomization cluster --with-source
|
||||
```
|
||||
|
||||
9. Verify git repository is now using SSH:
|
||||
|
||||
```sh
|
||||
flux get sources git -A
|
||||
```
|
||||
|
||||
10. Optionally set your repository to Private in your repository settings.
|
||||
|
||||
</details>
|
||||
|
||||
## 🙌 Related Projects
|
||||
|
||||
If this repo is too hot to handle or too cold to hold check out these following projects.
|
||||
|
||||
Reference in new issue
Block a user