Chapter 3. Deploying Consul
In this chapter, you will learn how to deploy Consul on Kubernetes or VMs. You can deploy Consul on self-managed or cloud-managed Kubernetes clusters and VMs. For testing purposes, and so you can complete the exercises throughout this book, this chapter also covers provisioning a Kubernetes cluster or VM on your local machine.
Once Consul is installed, you’ll learn how to interact with it through its UI, CLI, and API.
If you’re deploying Consul on VMs, skip ahead to “Deploying Consul on VMs”. Otherwise, continue reading to deploy Consul on Kubernetes.
Tip
If you’re unsure if you should use VMs or Kubernetes, I recommend deploying on Kubernetes because there are fewer steps.
Deploying Consul on Kubernetes
To deploy Consul on Kubernetes, you must first have a running Kubernetes cluster. Then you’ll use the consul-k8s CLI to install Consul with a single command.
Provisioning a Kubernetes Cluster
Consul can run on any type of Kubernetes cluster, whether in the cloud, for example, on Amazon Elastic Kubernetes Service (EKS) or Google Kubernetes Engine (GKE), or in a self-managed datacenter.
For the exercises in this book, if you’re running macOS or Linux, I recommend running Kubernetes on your local machine using a tool called minikube. I
recommend minikube because it’s free and because it has an automatic port-forwarding feature that makes it easy to access services without fiddling with a lot of kubectl port-forward
commands.
If minikube isn’t an option ...
Get Consul: Up and Running now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.