Time to get into Kubernetes! I'm going to go through this process manually at first, in order to familiarize myself with some of the details, before I start involving tools such as Terraform and Helm.
I've explored Caddy in the past, and I'm highly fond of its automatic HTTPS and straightforward syntax, so part of this setup is going to be configuring Caddy to be used as a reverse proxy:
demo-api.dango.space, localhost { respond / "Hello, World!" respond /health-check 204 reverse_proxy localhost:8080}
This will need to be available to our Caddy container. To do this we'll use the commandkubectl create configmap
. TheCaddyfile
can be used with thefrom-file
flag and we can use theoutput
flag to create ourconfigmap.yaml
file.
In ourdeployment.yaml
file, we'll be adding the Caddy container.
-name:caddyimage:caddy:2.9-alpineports:-containerPort:80-containerPort:443volumeMounts:-name:caddyfile-volumemountPath:/etc/caddy/CaddyfilesubPath:Caddyfile-name:caddy-datamountPath:/data
Thedata
directory needs to be persisted, so aPersistentVolume
andPersistentVolumeClaim
have been created to handle this.
In a later post I'll be taking a look at moving this over to an ingress controller.
Ourdemo-api
image has been added to thedeployment.yaml
, and the ports opened up in ourservice.yaml
. We have a cluster created on Digital Ocean, so we'll runkubectl apply
to provision our resources. We'll obtain our external IP address withkubectl get services
, add a new record to our domain, and we should be good to go!
The state of the repository as of this post can be foundhere.
A link to the next part will be available once it is written.
Top comments(0)
For further actions, you may consider blocking this person and/orreporting abuse