Deploying Applications without YAML
Warning
This content is part of the legacy version of Waypoint that is no longer actively maintained. For additional information on the new vision of Waypoint, check out this blog post and the HCP Waypoint documentation.
For many applications, Waypoint can deploy to Kubernetes with only
a handful of lines of configuration in the waypoint.hcl
file and zero
external configuration. For new applications, this is a great option to
get up and running easily. If your application becomes more complex later,
you can always switch deployment plugins.
Prefer writing YAML? That's okay! Waypoint supports
Helm and raw
kubectl apply
as first-class
deployment plugins, too.
A Simple Application
For a simple web application, you can get started with almost zero configuration:
With zero configuration, Waypoint will create a Kubernetes Deployment
with a PORT
environment variable that your application is expected to listen
on. And Waypoint will expose this application using a ClusterIP
service.
This is a perfect, minimal deployment for an internal service.
Common mistake: your application must be written to listen on the
PORT
environment variable for this to just work. If you want to change
the port to something else, specify it using the ports
configuration
shown below.
Scaling Up
With one more line of configuration, you can scale your application to more replicas:
Health Checking
With one line of configuration, you can specify an HTTP health check that
Kubernetes will use for both liveness and readiness. This HTTP endpoint
should listen on the service port and respond with a 2XX
status code
for success.
Alternate or Additional Ports
With zero configuration, your application must listen on the PORT
environment variable set by Waypoint. You can change the primary
service port using service_port
:
This is optimized and very simple for applications that have only one
primary listening port. If you require multiple ports, you must use the
slightly more complex ports
configuration and must NOT use the service_port
field (they are mutually exclusive).
Important! The first port is special. The first port is used as the expected HTTP listening port (regardless of name or any other settings).
Autoscaling
Waypoint can configure horizontal autoscaling in just a few lines:
Note that this requires that a metrics server
is running in your Kubernetes cluster. Waypoint will not set this up
automatically. Installing the metrics server is typically a single
kubectl apply
or Helm install.
Release Management
With the default Kubernetes deployment configuration, Waypoint creates
a single ClusterIP
type service. This is perfect for internal services
but doesn't work if you want to expose your application to the public internet.
By configuring a kubernetes
release stanza,
configuring release management for your service is also only a few lines
of HCL.
Be careful! This section is configuring the release
stanza, not
the deploy
stanza. If you're scrolling down this will be a very subtle
difference.
LoadBalancer
Service
The simplest way to expose your application to the global internet is to
use a LoadBalancer
service type. This is a one line change:
Ingress
You can expose your application through a Kubernetes Ingress:
This requires that you have an Ingress controller configured. Kubernetes does not do this by default. See the official Kubernetes documentation for more information.
Reference Documentation
To view a full list of the available options for the Kubernetes plugin, please see the plugin reference documentation. This documentation is more dense and has less examples, but is an exhaustive list of the available options.