Logo

dev-resources.site

for different kinds of informations.

Building and Deploying a New API (Part 3)

Published at
1/10/2025
Categories
kubernetes
caddy
dns
ssl
Author
m_dango
Categories
4 categories in total
kubernetes
open
caddy
open
dns
open
ssl
open
Author
7 person written this
m_dango
open
Building and Deploying a New API (Part 3)

Previous Post

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
}
Enter fullscreen mode Exit fullscreen mode

This will need to be available to our Caddy container. To do this we'll use the command kubectl create configmap. The Caddyfile can be used with the from-file flag and we can use the output flag to create our configmap.yaml file.

In our deployment.yaml file, we'll be adding the Caddy container.

- name: caddy
  image: caddy:2.9-alpine
  ports:
    - containerPort: 80
    - containerPort: 443
  volumeMounts:
    - name: caddyfile-volume
      mountPath: /etc/caddy/Caddyfile
      subPath: Caddyfile

    - name: caddy-data
      mountPath: /data
Enter fullscreen mode Exit fullscreen mode

The data directory needs to be persisted, so a PersistentVolume and PersistentVolumeClaim have been created to handle this.

In a later post I'll be taking a look at moving this over to an ingress controller.

Our demo-api image has been added to the deployment.yaml, and the ports opened up in our service.yaml. We have a cluster created on Digital Ocean, so we'll run kubectl apply to provision our resources. We'll obtain our external IP address with kubectl get services, add a new record to our domain, and we should be good to go!

https://demo-api.dango.space/

The state of the repository as of this post can be found here.

A link to the next part will be available once it is written.

dns Article's
30 articles in total
Favicon
Building and Deploying a New API (Part 3)
Favicon
Configuring a custom domain for your Azure Static Web App
Favicon
วิธีติดตั้งและกำหนดค่าเบื้องต้นสำหรับเซิร์ฟเวอร์ DNS บน Ubuntu 22.04 LTS แบบง่าย ๆ
Favicon
Email Verifier using Go
Favicon
What are DNS records?
Favicon
How to understand the ins and outs of how DNS really works.
Favicon
How to Simplify DNS Management in a Multi-Account Environment with Route 53 Resolver
Favicon
How to Add an Elastic (Static) IP to Your EC2 Instance And Update Your DNS Records on Route53
Favicon
DNS Spoofing: Controlling DNS Requests on the Network
Favicon
DHCP dinamik DNS güncellemesi
Favicon
Migrate a hosted zone to a different AWS account in few seconds!!
Favicon
Explaining DNS NXDOMAIN status in SOA Record Type: On Non-Existing Domains
Favicon
Instant Domain Insights: Why Every Tech Professional Needs DNS Checker Pro
Favicon
Automating DNS Management in Kubernetes with ExternalDNS
Favicon
DNS-load-balancing
Favicon
Verify your Bluesky or Mastodon account on your own domain, with a free website!
Favicon
How to Install and Configure a Private BIND DNS Server on Ubuntu 22.04
Favicon
How to Add DNS Records for Your Domain in Route53
Favicon
AWS S3 Change Url, Proxy Url, Map to Domain in 2024
Favicon
From WHOIS to SSL: How DNS Checker Pro Unveils the Hidden Details of Any Website
Favicon
Automating AWS DNS Firewall Domain List Updates Using S3, Lambda, and CLI
Favicon
Explaining CAA DNS Record
Favicon
Mastering DNS Spoofing with Bettercap: A Comprehensive Guide
Favicon
Issue 65 of AWS Cloud Security Weekly
Favicon
Unlocking the Internet's Address Book: DNS Roots Explained!
Favicon
I bought us-east-1.com: A Look at Security, DNS Traffic, and Protecting AWS Users
Favicon
Unlocking the Power of AWS Route 53: Your Complete Guide to DNS Management
Favicon
DNS: More Than Just a Web Directory
Favicon
Automating DNS with Confidence: Terraform + DNScontrol
Favicon
"Message Not Delivered" - What to Do When Your Email Bounces Back?

Featured ones: