is there a way garden yaml can reuse existing kub...
# 🤖|ask-kapa
e
@microscopic-river-74022 is there a way garden yaml can reuse existing kubernetes manifest files?
m
Please stand by @enough-postman-52378 as I search the knowledge base. I normally take about 20 seconds or so. :wave:
---------------------- Yes, Garden allows you to reuse existing Kubernetes manifest files in your
garden.yml
configuration. You can point Garden to your manifest files using the
spec.files
directive when configuring a
kubernetes
Deploy action. Here is an example of how you can reference the manifests:
Copy code
yaml
kind: Deploy
type: kubernetes
name: api
spec:
  files:
    - ./manifests/Deployment.yaml
    - ./manifests/Ingress.yaml
    - ./manifests/Service.yaml
You can also use glob patterns to include all files in a directory:
Copy code
yaml
kind: Deploy
type: kubernetes
name: api
spec:
  files:
    - ./manifests/*
If your manifests are in a parent directory relative to the action config file, you need to set the
source.path
field for your action since Garden cannot include files from parent directories. For example:
Copy code
yaml
kind: Deploy
type: kubernetes
name: api
source:
  path: ../ # <--- Garden will now treat the parent directory as the action source path
spec:
  files:
    - ./manifests/Deployment.yaml
    - ./manifests/Ingress.yaml
    - ./manifests/Service.yaml
You can also use Garden's templating to reuse manifests and override names, labels, and such in the base manifests. However, note that using Garden template strings in manifests means they won't work with systems like
kubectl apply
.
For more information, you can refer to the following sources: - Kubernetes-plugins > Actions > Deploy > Kubernetes () - Reference > Action-types > Deploy > kubernetes Deploy > Description () - Kubernetes-plugins > Actions > Deploy > Kubernetes > Referencing manifests > Option 1: Manifest files (recommended) () ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
message has been deleted
e
how about reusing k8s.yaml files
@microscopic-river-74022 how about reusing k8s.yaml file
m
Let me check the knowledge base for you. One moment! :books:
---------------------- Yes, you can reuse a
k8s.yaml
file in your Garden configuration. You can specify the path to your
k8s.yaml
file in the
files
field of the
spec
section when configuring a
kubernetes
Deploy action in your
garden.yml
file. Here is an example:
Copy code
yaml
kind: Deploy
type: kubernetes
name: api
spec:
  files:
    - ./path/to/your/k8s.yaml
This tells Garden to use the Kubernetes manifests defined in
k8s.yaml
when deploying the
api
service. For more information, you can refer to the following sources: - Kubernetes-plugins > Actions > Deploy > Kubernetes () - Reference > Action-types > Deploy > kubernetes Deploy > Description () - Kubernetes-plugins > Actions > Deploy > Kubernetes > Referencing manifests > Option 1: Manifest files (recommended) () ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
message has been deleted
3 Views