Consul + Kubernetes (consul-k8s)
consul-k8s binary includes first-class integrations between Consul and
Kubernetes. The project encapsulates multiple use cases such as syncing
services, injecting Connect sidecars, and more.
The Kubernetes integrations with Consul are
documented directly on the Consul website.
This README will present a basic overview of each use case, but for full
documentation please reference the Consul website.
This project is versioned separately from Consul. Supported Consul versions for each feature will be noted below. By versioning this project separately, we can iterate on Kubernetes integrations more quickly and release new versions without forcing Consul users to do a full Consul upgrade.
- Catalog Sync: Sync Consul services into first-class Kubernetes services and vice versa. This enables Kubernetes to easily access external services and for non-Kubernetes nodes to easily discover and access Kubernetes services. (Requires Consul 1.1+)
consul-k8s is distributed in multiple forms:
The recommended installation method is the official Consul Helm chart. This will automatically configure the Consul and Kubernetes integration to run within an existing Kubernetes cluster.
A Docker image
hashicorp/consul-k8sis available. This can be used to manually run
consul-k8swithin a scheduled environment.
Raw binaries are available in the HashiCorp releases directory. These can be used to run
consul-k8sdirectly or build custom packages.
To build and install
consul-k8s locally, Go version 1.11.4+ is required because this repository uses go modules and go 1.11.4 introduced changes to checksumming of modules to correct a symlink problem.
You will also need to install the Docker engine:
Clone the repository:
$ git clone https://github.com/hashicorp/consul-k8s.git
To compile the
consul-k8s binary for your local machine:
$ make dev
This will compile the
consul-k8s binary into
well as your
$GOPATH and run the test suite.
Or run the following to generate all binaries:
$ make dist
If you just want to run the tests:
$ make test
Or to run a specific test in the suite:
go test ./... -run SomeTestFunction_name
To create a docker image with your local changes:
$ make dev-docker