containeraction type is an abstraction that can be used with multiple plugins. See here for an in-depth guide on the action type itself. Continue reading for more information on the container deploy action type that can be used with the Kubernetes plugin.
The Kubernetes plugins can deploy
Garden will take the simplified
containerdeploy specification and convert it to Kubernetes manifests, i.e. Deployment, Service and (if applicable) Ingress resources.
- name: http
- path: /hello-frontend
- path: /call-backend
buildfield is used to specify a build action that builds the contianer that's used for the deploy. We also configure a health check, a couple of ingress endpoints, and specify that this deploy depends on the
backenddeploy. There is a number of other options, which you can find in the
If you need to use advanced (or otherwise very specific) features of the underlying platform, you may need to use more platform-specific action types (e.g.
containeraction type is not intended to capture all those features.
Container services can specify environment variables, using the
You can reference secrets in environment variables. For Kubernetes, this translates to
valueFrom.secretKeyReffields in the Pod specs, which direct Kubernetes to mount values from
Secretresources that you have created in the application namespace, as environment variables in the Pod.
This will pull the
some-key-in-secretkey from the
my-secretSecret resource in the application namespace, and make it available as an environment variable.
Note that you must create the Secret manually for the Pod to be able to reference it.
For Kubernetes, this is commonly done using
kubectl. For example, to create a basic generic secret you could use:
kubectl --namespace <my-app-namespace> create secret generic --from-literal=some-key-in-secret=foo
<my-app-namespace>is your project namespace (which is either set with
namespacein your provider config, or defaults to your project name). There are notably other, more secure ways to create secrets via
kubectl. Please refer to the official Kubernetes Secrets docs for details.