Skip to content

Commit

Permalink
feat: disabling systemd-resolved on k8s nodes
Browse files Browse the repository at this point in the history
- we are exposing our own DNS server, which needs to be exposed on port
  53/udp to work
  • Loading branch information
nxtcoder17 committed Jul 28, 2024
1 parent 5d63672 commit 5fc6061
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 0 additions & 1 deletion terraform/modules/gcp/machine/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ resource "google_compute_instance" "standard" {
block-project-ssh-keys = "TRUE"
enable-oslogin = "TRUE"
"ssh-keys" = "ubuntu:${var.ssh_key}"
# join("\n", [for user, key in var.ssh_keys : "${user}:${key}"])
}

network_interface {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ ${jsonencode({
})}
EOF2

if [ "${tf_use_cloudflare_nameserver}" = "true" ]; then
lineNo=$(sudo cat /etc/resolv.conf -n | grep "nameserver" | awk '{print $1}')
sudo sed -i "$lineNo i nameserver 1.1.1.1" /etc/resolv.conf
fi
{{- /* if [ "${tf_use_cloudflare_nameserver}" = "true" ]; then */}}
{{- /* lineNo=$(sudo cat /etc/resolv.conf -n | grep "nameserver" | awk '{print $1}') */}}
{{- /* sudo sed -i "$lineNo i nameserver 1.1.1.1" /etc/resolv.conf */}}
{{- /* fi */}}

sudo systemctl restart kloudlite-k3s.service
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ KLOUDLITE_RUNNER_DOWNLOAD_URL="${kloudlite_runner_download_url}"
# LOG_FILE=$KLOUDLITE_CONFIG_DIRECTORY/execution.log

debug() {
echo "[#] $*" >>"$KLOUDLITE_CONFIG_DIRECTORY/execution.log"
echo "[#] $*" >>"$KLOUDLITE_CONFIG_DIRECTORY/execution.log"
}

debug "ensuring $KLOUDLITE_CONFIG_DIRECTORY exists"
Expand Down Expand Up @@ -61,4 +61,10 @@ WantedBy=multi-user.target
EOF

systemctl enable --now kloudlite-k3s.service

systemctl stop systemd-resolved
systemctl disable systemd-resolved

rm /etc/resolv.conf
echo "nameserver 1.1.1.1" >/etc/resolv.conf
debug "----------------- execution finished at $(date) ----------------------"

0 comments on commit 5fc6061

Please sign in to comment.