Skip to content

Commit c3276c0

Browse files
tillepillesolidnerd
authored andcommitted
bump versions
feature gates available make script more resilient update calico fix readme
1 parent 1213552 commit c3276c0

File tree

7 files changed

+39
-39
lines changed

7 files changed

+39
-39
lines changed

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,20 @@ $ KUBECONFIG=secrets/admin.conf kubectl expose deploy nginx --port=80 --type Nod
2828

2929
| Name | Default | Description | Required |
3030
|:-------------------------|:-------------|:----------------------------------------------------------------------------------|:--------:|
31-
| `hcloud_token` | `` |API Token that will be generated through your hetzner cloud project https://console.hetzner.cloud/projects | Yes |
32-
| `master_count` | `1` | Amount of masters that will be created | No |
33-
| `master_image` | `ubuntu-16.04` | Predefined Image that will be used to spin up the machines (Currently supported: ubuntu-16.04, debian-9,centos-7,fedora-27) | No |
34-
| `master_type` | `cx11` | Machine type for more types have a look at https://www.hetzner.de/cloud | No |
35-
| `node_count` | `1` | Amount of nodes that will be created | No |
36-
| `node_image` | `ubuntu-16.04` | Predefined Image that will be used to spin up the machines (Currently supported: ubuntu-16.04, debian-9,centos-7,fedora-27) |
37-
| `node_type` | `cx11` | Machine type for more types have a look at https://www.hetzner.de/cloud | No |
38-
| `ssh_private_key` | `~/.ssh/id_ed25519` | Private Key to access the machines |
39-
| `ssh_public_key` | `~/.ssh/id_ed25519.pub` | Public Key to authorized the access for the machines | No |
40-
| `docker_version` | `18.06` | Docker CE version that will be installed | No |
41-
| `kubernetes_version` | `1.12.2` | Kubernetes version that will be installed | No |
42-
| `core_dns` | `false` | Enables CoreDNS as Service Discovery | No |
43-
| `calico_enabled` | `false` | Installs Calico Network Provider after the master comes up | No |
31+
| `hcloud_token` | `` |API Token that will be generated through your hetzner cloud project https://console.hetzner.cloud/projects | Yes |
32+
| `master_count` | `1` | Amount of masters that will be created | No |
33+
| `master_image` | `ubuntu-16.04` | Predefined Image that will be used to spin up the machines (Currently supported: ubuntu-16.04, debian-9,centos-7,fedora-27) | No |
34+
| `master_type` | `cx11` | Machine type for more types have a look at https://www.hetzner.de/cloud | No |
35+
| `node_count` | `1` | Amount of nodes that will be created | No |
36+
| `node_image` | `ubuntu-16.04` | Predefined Image that will be used to spin up the machines (Currently supported: ubuntu-16.04, debian-9,centos-7,fedora-27) | No |
37+
| `node_type` | `cx11` | Machine type for more types have a look at https://www.hetzner.de/cloud | No |
38+
| `ssh_private_key` | `~/.ssh/id_ed25519` | Private Key to access the machines | No |
39+
| `ssh_public_key` | `~/.ssh/id_ed25519.pub` | Public Key to authorized the access for the machines | No |
40+
| `docker_version` | `19.03` | Docker CE version that will be installed | No |
41+
| `kubernetes_version` | `1.15.5` | Kubernetes version that will be installed | No |
42+
| `feature_gates` | `` | Add your own Feature Gates for Kubeadm | No |
43+
| `calico_enabled` | `false` | Installs Calico Network Provider after the master comes up | No |
44+
4445
All variables cloud be passed through `environment variables` or a `tfvars` file.
4546

4647
An example for a `tfvars` file would be the following `terraform.tfvars`

files/10-kubeadm.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[Service]
22
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --cgroup-driver=cgroupfs"
3-
Environment="KUBELET_SYSTEM_PODS_ARGS=--pod-manifest-path=/etc/kubernetes/manifests --allow-privileged=true"
3+
Environment="KUBELET_SYSTEM_PODS_ARGS=--pod-manifest-path=/etc/kubernetes/manifests"
44
Environment="KUBELET_NETWORK_ARGS=--network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin"
55
Environment="KUBELET_DNS_ARGS=--cluster-dns=10.96.0.10 --cluster-domain=cluster.local"
66
Environment="KUBELET_AUTHZ_ARGS=--authorization-mode=Webhook --client-ca-file=/etc/kubernetes/pki/ca.crt"

install-calico.tf

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,9 @@ resource "null_resource" "calico" {
77
}
88

99
provisioner "remote-exec" {
10-
inline = [
11-
"kubectl apply -f https://docs.projectcalico.org/v3.2/getting-started/kubernetes/installation/hosted/etcd.yaml",
12-
"kubectl apply -f https://docs.projectcalico.org/v3.2/getting-started/kubernetes/installation/rbac.yaml",
13-
"kubectl apply -f https://docs.projectcalico.org/v3.2/getting-started/kubernetes/installation/hosted/calico.yaml"
14-
]
10+
inline = ["kubectl apply -f https://docs.projectcalico.org/v3.8/manifests/calico.yaml"]
1511
}
1612

17-
depends_on = [hcloud_server.master]
13+
depends_on = ["hcloud_server.master"]
1814
}
1915

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ resource "hcloud_server" "master" {
4040
}
4141

4242
provisioner "remote-exec" {
43-
inline = ["CORE_DNS=${var.core_dns} bash /root/master.sh"]
43+
inline = ["FEATURE_GATES=${var.feature_gates} bash /root/master.sh"]
4444
}
4545

4646
provisioner "local-exec" {

scripts/bootstrap.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,20 @@ set -eu
33
DOCKER_VERSION=${DOCKER_VERSION:-}
44
KUBERNETES_VERSION=${KUBERNETES_VERSION:-}
55

6+
7+
waitforapt(){
8+
while fuser /var/lib/apt/lists/lock >/dev/null 2>&1 ; do
9+
echo "Waiting for other software managers to finish..."
10+
sleep 1
11+
done
12+
}
13+
614
echo "
715
Package: docker-ce
816
Pin: version ${DOCKER_VERSION}.*
917
Pin-Priority: 1000
1018
" > /etc/apt/preferences.d/docker-ce
11-
sleep 30
19+
waitforapt
1220
apt-get -qq update
1321
apt-get -qq install -y \
1422
apt-transport-https \
@@ -47,6 +55,7 @@ Pin: version ${KUBERNETES_VERSION}-*
4755
Pin-Priority: 1000
4856
" > /etc/apt/preferences.d/kubeadm
4957

58+
waitforapt
5059
apt-get -qq update
5160
apt-get -qq install -y kubelet kubeadm
5261

scripts/master.sh

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
#!/usr/bin/bash
22
set -eu
33

4-
KUBERNETES_VERSION=${KUBERNETES_VERSION:-}
5-
CORE_DNS=${CORE_DNS:-}
6-
7-
echo "
8-
Package: kubectl
9-
Pin: version ${KUBERNETES_VERSION}-*
10-
Pin-Priority: 1000
11-
" > /etc/apt/preferences.d/kubectl
12-
13-
apt-get install -qq -y kubectl
14-
154
# Initialize Cluster
16-
kubeadm init --feature-gates CoreDNS="$CORE_DNS"
17-
5+
if [[ -n "$FEATURE_GATES" ]]
6+
then
7+
kubeadm init --pod-network-cidr=192.168.0.0/16 --feature-gates $FEATURE_GATES
8+
else
9+
kubeadm init --pod-network-cidr=192.168.0.0/16
10+
fi
1811
systemctl enable docker kubelet
1912

2013
# used to join nodes to the cluster

variables.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,16 @@ variable "ssh_public_key" {
3838
}
3939

4040
variable "docker_version" {
41-
default = "18.06"
41+
default = "19.03"
4242
}
4343

4444
variable "kubernetes_version" {
45-
default = "1.12.2"
45+
default = "1.15.5"
4646
}
4747

48-
variable "core_dns" {
49-
default = false
48+
variable "feature_gates" {
49+
description = "Add Feature Gates e.g. 'DynamicKubeletConfig=true'"
50+
default = ""
5051
}
5152

5253
variable "calico_enabled" {

0 commit comments

Comments
 (0)