Deploy shlink to K8s

Bhautik Chudasama
2 min readAug 15, 2021

--

First of all, what is shlink? shlink allow you to create your self-hosted URL shortener server, Not just short URL but provide facility for tracking. It also allows you to create short using the command line, Rest API, and Web Interface. So that’s all, let get started.

Requirements

  • You need a k8s cluster.
  • Shlink support an externally hosted database server which is recommended (MySQL, MariaDB, Postgresql, MSSQL), If you haven’t any of these databases it uses SQLite.

Dig Into The Cluster

  1. Create a namespace.

2. Configure environment variables, In my case, I am using PostgreSQL as a database. (https://shlink.io/documentation/install-docker-image/#use-an-external-db)

3. Create a deployment

4. Create Cluster IP service

5. Optional: Certificate generation. Make sure you have made an entry in the DNS server.

6. Final Create an Ingress, So It can be accessible outside.

7. After everything is done, Please verify by visit the host. and see can something like and In title (Not Found | Shlink). This means you are able to create the short URL using API, and command.

Ah, It’s tired process to create a short URL using Rest API, So shrink provide the web interface to manage short URLs. First, you need to generate API key by dig into the pod using

Copy the generated API key, and visit app.shlink.io, fill in necessary details

That done 🎉, Next time you need to remember only https://app.shlink.io

One of the disadvantages I found is whenever you change your device you need to remember API keys or save something for login.

Thanks for reading, Have a good day!

--

--

Bhautik Chudasama

Just Bhautik with Software Engineer | Software Architect | DevOps | SRE http://rmtsbus.in and self. Enjoy the web.