2

After installing FluxCD v2 on my EKS cluster, I defined a GitRepository definition pointing to a repo on GitHub.

---
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: GitRepository
metadata:
  name: springbootflux-infra
  namespace: flux-system
spec:
  interval: 30s
  ref:
    branch: master
  url: https://github.com/***/privaterepo

As the name says, yhe privaterepo on GitHub is a private. Problem is that FluxCD cannot read the repo. What can I do to allow FluxCD on EKS to be able to read the repo?

Marc Enschede
  • 828
  • 10
  • 16
  • Could you please check my other answer on a bit similar issue? https://stackoverflow.com/a/68321967/4017403 Does it help you? – Anas Tiour Jul 09 '21 at 19:38

1 Answers1

2

For private repositories you need to define a secret which contains the credentials.

Create a secret:

apiVersion: v1
kind: Secret
metadata:
  name: repository-creds
type: Opaque
data:
  username: <BASE64>
  password: <BASE64>

Refer to the secret in your GitRepository object:

  secretRef:
    name: repository-creds

Official documentation: https://fluxcd.io/docs/components/source/gitrepositories/#secret-reference

Paulo Gomes
  • 334
  • 3
  • 7