Previous blog posts of "GitLab + K3S"
🇬🇧 GitLab + K3S: How to use DNSMasq instead nip.io
Last time, the service nip.io was down, and my services unavailable, so I searched an alternative. Some friends pointed me DNSMasq. I struggled several days with it, but finally today, I succeeded, and in fact, it's simple (but when your skills are not network oriented, the learning could be hard 😉).
My use case: right now, the url of my services is build like that:
192.168.64.27 is the IP address of my K3S cluster).
Now, I would like something like that:
Install and configuration
First, install DNSMasq (I'm on OSX, but I'm sure my 🐧 friends will adapt this):
brew install dnsmasq
Next, create a file like this one below, with an entry corresponding to your "wildcard" DNS and the IP address of the cluster:
echo "address=/.demo.g33k/192.168.64.27" > /usr/local/etc/dnsmasq.d/development.conf
Then, update the network settings of your Mac, adding
127.0.0.1) as DNS:
Click on Ok then on Apply
sudo brew services restart dnsmasq
Now, create a "resolver" linked to your domain:
sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/demo.g33k'
Check the routing:
dig hey.demo.g33k @127.0.0.1
You should get something like this:
; <<>> DiG 9.10.6 <<>> hey.demo.k33g @127.0.0.1 ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7844 ;; flags: qr aa rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;hey.demo.k33g. IN A ;; ANSWER SECTION: hey.demo.k33g. 0 IN A 192.168.64.27 ;; Query time: 0 msec ;; SERVER: 127.0.0.1#53(127.0.0.1) ;; WHEN: Mon Mar 23 16:02:39 CET 2020 ;; MSG SIZE rcvd: 61
Check the ping:
You should get something like that:
PING hey.demo.g33k (192.168.64.27): 56 data bytes 64 bytes from 192.168.64.27: icmp_seq=0 ttl=64 time=0.232 ms 64 bytes from 192.168.64.27: icmp_seq=1 ttl=64 time=0.324 ms
Of course, you have started the K3S cluster
So, now you need to change something with your deployment (in
And the environment url:
And now, you just had to restart your CI.
That's all 🎉 (for the moment) 😉
- 🇬🇧 Every GitLab Page deserves a real CI/CD | 2020-07-23 | GitLab CI
- 🇫🇷 Lit-Element, commencer doucement | 2020-07-20 | WebComponent
- 🇬🇧 Build quickly and host easily your Docker images with GitLab and GitLab CI | 2020-06-02 | GitLab CI
- 🇬🇧 Deploy quickly on Clever Cloud with GitLab CI | 2020-05-31 | GitLab CI
- 🇫🇷 Borg Collective, mes jouets pour apprendre Knative | 2020-05-30 | Knative
- 🇬🇧 Borg Collective, Toys to learn Knative | 2020-05-30 | Knative
- 🇫🇷 M5Stack, une petit device IOT bien sympathique, programmable en Python | 2020-05-09 | IOT
- 🇫🇷 Knative, l'outil qui rend Kubernetes sympathique | 2020-05-02 | kubernetes
- 🇬🇧 Knative, the tool that makes Kubernetes lovable | 2020-05-02 | kubernetes
- 🇫🇷 Kit de survie K8S pour les dévs avec K3S - Partie 9 - retour à Vagrant | 2020-04-18 | kubernetes