Kustomize resource GitHub private repository

1/7/2022

I was wondering if is possible to get resources from kustomize in a private GitHub repository, I already tried something like this without success

apiVersion: kustomize.config.k8s.io/v1beta1

kind: Kustomization

resources:
- git@github.com:gituser/kustomize.git/kustomize/main/nginx.yaml

- ssh://github.com/gituser/kustomize.git/kustomize/main/nginx.yaml

error

Error: accumulating resources: accumulation err='accumulating resources from 'ssh://github.com/diego1277/kustomize.git//kustomize/main/nginx.yaml': evalsymlink failure on '/Users/diego/Desktop/estudo/kustomize/see/base/ssh:/github.com/diego1277/kustomize.git/kustomize/main/nginx.yaml' : lstat /Users/diego/Desktop/estudo/kustomize/see/base/ssh:: no such file or directory': evalsymlink failure on '/private/var/folders/qq/mk6t7dpd5435qm78_zsfdjvm0000gp/T/kustomize-056937086/kustomize/main/nginx.yaml' : lstat /private/var/folders/qq/mk6t7dpd5435qm78_zsfdjvm0000gp/T/kustomize-056937086/kustomize: no such file or directory
-- user3573246
devops
github
kubernetes
kustomize

1 Answer

1/7/2022

Your remote resource needs to resolve to a directory that contains a kustomization.yaml file. That is, instead of:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- git@github.com:gituser/kustomize.git/kustomize/main/nginx.yaml

You need:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- git@github.com:gituser/kustomize.git/kustomize/main/

And your kustomize/main directory should contain kustomization.yaml. You can try this out using a public repository, for example:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
  - "git@github.com:kubernetes-sigs/kustomize/examples/helloWorld"
-- larsks
Source: StackOverflow