Skip to content
This repository has been archived by the owner on Jun 19, 2021. It is now read-only.

Commit

Permalink
fix(networking): allow cluster internal communication
Browse files Browse the repository at this point in the history
since Scaleway does not have private DNS that resolves by default we have to
change the hostnames to the internal IP prior to registering workers.

Then the internal communication works fine
  • Loading branch information
nicolai86 committed Oct 24, 2016
1 parent e546128 commit 423376a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ resource "scaleway_server" "k8s-master" {

provisioner "remote-exec" {
inline = [
"sudo echo ${self.private_ip} > /tmp/private_ip",
"sudo chmod +x /tmp/master.sh",
"sudo /tmp/master.sh",
]
Expand Down Expand Up @@ -80,6 +81,7 @@ resource "scaleway_server" "k8s-worker" {

provisioner "remote-exec" {
inline = [
"sudo echo ${self.private_ip} > /tmp/private_ip",
"sudo chmod +x /tmp/worker.sh",
"sudo /tmp/worker.sh",
]
Expand Down
9 changes: 8 additions & 1 deletion templates/master.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/bin/bash -v

# modify hostname to allow communication between Scaleway instances.
private_ip=$(cat /tmp/private_ip)
hostname $private_ip
echo $private_ip > /etc/hostname
echo "127.0.0.1 $private_ip" >> /etc/hosts

# install kubernetes master
apt-get install -y apt-transport-https

curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
Expand All @@ -11,7 +18,7 @@ apt-get install -y kubelet kubeadm kubectl kubernetes-cni
curl -sSL https://get.docker.com/ | sh
systemctl start docker

kubeadm init --token=${k8stoken}
kubeadm init --token=${k8stoken} --use-kubernetes-version v1.4.3

kubectl apply -f https://git.io/weave-kube

Expand Down
7 changes: 7 additions & 0 deletions templates/worker.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/bin/bash -v

# modify hostname to allow communication between Scaleway instances.
private_ip=$(cat /tmp/private_ip)
hostname $private_ip
echo $private_ip > /etc/hostname
echo "127.0.0.1 $private_ip" >> /etc/hosts

# install kubernetes worker
apt-get install -y apt-transport-https

curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
Expand Down

0 comments on commit 423376a

Please sign in to comment.