6

I want to use vars without ConfigMaps or Secrets. Declaring a value would be sufficient for me. But I couldn't see any documentation regarding vars attributes or how I can use. Do you know any docs about this? Thanks!

vars:
  - name: ROUTE_HOST
    objref:
      kind: ConfigMap
      name: template-vars
      apiVersion: v1
    fieldref:
      fieldpath: data.ROUTE_HOST
cosmos-1905-14
  • 783
  • 2
  • 12
  • 23
  • There is no vars in Kustomize. You can use _overlays_, but it is a bit different. – Jonas Oct 07 '21 at 15:47
  • @Jonas there is. I'm using it with ConfigMaps, https://serverfault.com/questions/1020451/kubernetes-kustomize-how-to-use-var-in-configmapgenerator – cosmos-1905-14 Oct 07 '21 at 16:31
  • 2
    You are right, Kustomize vars are still there, but they are **deprecated** - I thought that they where gone already. Docs here: https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/vars/ – Jonas Oct 07 '21 at 19:08

1 Answers1

3

Summarizing Jonas's comments:

WARNING: There are plans to deprecate vars. For existing users of vars, we recommend migration to replacements as early as possible. There is a guide for convering vars to replacements at the bottom of this page under “convert vars to replacements”. For new users, we recommend never using vars, and starting with replacements to avoid migration in the future.

Please find more information in the official documentation.

Try to use replacements as it's suggested above.

Bazhikov
  • 765
  • 3
  • 11