@hashicorp
The Kubernetes Apply plugin deploys Kubernetes resources directly from a single file or a directory of YAML or JSON files.
- Official
- Built-in
Updated 9 months ago
- GitHub(opens in new tab)
Kubernetes Apply Platform
Deploy Kubernetes resources directly from a single file or a directory of YAML or JSON files.
This plugin lets you use any pre-existing set of Kubernetes resource files to deploy to Kubernetes. This plugin supports all the features of Waypoint. You may use Waypoint's templating features to template the resources with information such as the artifact from a previous build step, entrypoint environment variables, etc.
Requirements
This plugin requires "kubectl" to be installed since this plugin works by subprocessing to "kubectl apply". Other Waypoint Kubernetes plugins sometimes use the API directly but this plugin requires "kubectl".
"kubectl" must also be configured to access your Kubernetes cluster. You may specify an alternate kubeconfig file using the "kubeconfig" configuration parameter. If this isn't specified, the default kubectl lookup paths will be used.
Artifact Access
You may use Waypoint's templating features
to access information such as the artifact from the build or push stages.
An example below shows this by using templatedir
mixed with
variables such as artifact.image
to dynamically configure the
Docker image within a Kubernetes Deployment.
Entrypoint Functionality
Waypoint entrypoint functionality such as logs, exec, app configuration, and more require two properties to be true:
The running image must already have the Waypoint entrypoint installed and configured as the entrypoint. This should happen in the build stage.
Proper environment variables must be set so the entrypoint knows how to communicate to the Waypoint server. This step happens in this deployment stage.
Step 2 does not happen automatically. You must manually set the entrypoint environment variables using the templating feature. One of the examples below shows the entrypoint environment variables being injected.
URL Service
If you want your workload to be accessible by the Waypoint URL service, you must set the PORT environment variable within the pod with your web service and also be using the Waypoint entrypoint (documented in the previous section).
The PORT environment variable should be the port that your web service is listening on that the URL service will connect to. See one of the examples below for more details.
Interface
- Input: None
- Output: k8sapply.Deployment
Examples
Parameters
5 Results
Path to a file or directory of YAML or JSON files. This will be used for
kubectl apply
to create a set of Kubernetes resources. Pair this withtemplatefile
ortemplatedir
templating functions to inject dynamic elements into your Kubernetes resources. Subdirectories are included recursively.