1

thanks for checking out my topic.

I'm currently working to have kustomize to download the resource and base files from our git repository. We have tried a few options some of them following the documentation and some of them not, see below. But anyhow still not able to download from our remote repo and while trying to run the kubectl apply it looks for a local resource based on the git url and file names.

resources:
  - ssh://git@SERVERURL:$PORT/$REPO.GIT
  - git::ssh://git@SERVERURL:$PORT/$REPO.GIT
  - ssh::git@SERVERURL:$PORT/$REPO.GIT
  - git::git@SERVERURL:$PORT/$REPO.GIT
  - git@SERVERURL:$PORT/$REPO.GIT

As a workaround I have added the git clone for the expected folder to my pipeline, but the goal is to have the bases/resources downloaded directly from the kustomization url. Any ideas or some hints on how to get it running?

  • You probably need a plugin for kubectl to be able to authenticate to private git repositories. – Jonas Oct 20 '21 at 15:19

2 Answers2

1

Use bases instead of resources:

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

bases:
  - github.com/kubernetes-sigs/aws-efs-csi-driver/deploy/kubernetes/overlays/stable/ecr/?ref=release-1.0

resources:
  - rbac.yaml
  - manifest.yaml

add the complete route to your source and add param ref to the tag or branch you want to download.

TlmaK0
  • 3,578
  • 2
  • 31
  • 51
1

After reaching some Kubernetes colleagues, we found out the reason for my problem. Basically, when running kubectl with version lower than 1.20 we have kustomize v2.0.3. My Jenkins agent was using a outdated kubectl version (1.17) and this was the root cause.

In this case, there were two options:

  1. Update kubectl image, with 1.20 or higher,
  2. Decouple kustomization and kubectl (fits better in our case).