Move from K8s installation with the konfigadm

Relates-To: #293

Change-Id: I0c3c7306c2edb2913cada973281eb97db5505f81
This commit is contained in:
Nikolay Fedorov 2020-07-16 12:06:56 +04:00
parent 53e4f7ffc6
commit b0397e2440
2 changed files with 36 additions and 22 deletions

View File

@ -20,9 +20,24 @@ stringData:
gecos: deployer
ssh_pwauth: True
runcmd:
- curl -L https://github.com/flanksource/konfigadm/releases/download/v0.4.14/konfigadm
-o /usr/local/bin/konfigadm && chmod +x /usr/local/bin/konfigadm
- konfigadm apply --config=/tmp/konfigadm.yml
- |
cat <<EOF | tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
- sysctl --system
- curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
- curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
- echo "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee -a /etc/apt/sources.list
- echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list
- apt-get update
- apt-get install -y
docker-ce="$(apt policy docker-ce | grep 19.03.9 | sort | head -n 1 | tr -s " " | cut -d ' ' -f 2 )"
docker-ce-cli="$(apt policy docker-ce-cli | grep 19.03.9 | sort | head -n 1 | tr -s " " | cut -d ' ' -f 2 )"
containerd.io
- swapoff -a
- apt-get install -y kubelet=1.17.3-00 kubeadm=1.17.3-00 kubectl=1.17.3-00
- apt-mark hold kubelet kubeadm kubectl
- kubeadm init --config /tmp/kubeadm.yaml
- kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f https://docs.projectcalico.org/v3.8/manifests/calico.yaml
- mkdir -p /opt/metal3-dev-env/ironic/html/images
@ -62,14 +77,6 @@ stringData:
owner: root:root
path: /etc/kubernetes/pki/ca.key
permissions: "0600"
- content: |
kubernetes:
version: 1.17.3
container_runtime:
type: docker
owner: root:root
path: /tmp/konfigadm.yml
permissions: "0640"
- content: |
---
apiServer:

View File

@ -11,8 +11,24 @@ spec:
name: cluster-controlplane
kubeadmConfigSpec:
preKubeadmCommands:
- wget -O "/usr/bin/konfigadm" https://github.com/flanksource/konfigadm/releases/download/v0.5.3/konfigadm && chmod +x "/usr/bin/konfigadm"
- konfigadm apply --config=/konfigadm.yml
- |
cat <<EOF | tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
- sysctl --system
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
- add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list
- apt-get update
- apt-get install -y
docker-ce="$(apt policy docker-ce | grep 19.03.9 | sort | head -n 1 | tr -s " " | cut -d ' ' -f 2 )"
docker-ce-cli="$(apt policy docker-ce-cli | grep 19.03.9 | sort | head -n 1 | tr -s " " | cut -d ' ' -f 2 )"
containerd.io
- swapoff -a
- apt-get install -y kubelet=1.17.3-00 kubeadm=1.17.3-00 kubectl=1.17.3-00
- apt-mark hold kubelet kubeadm kubectl
initConfiguration:
nodeRegistration:
name: '{{ ds.meta_data.local_hostname }}'
@ -26,15 +42,6 @@ spec:
node-labels: 'metal3.io/uuid={{ ds.meta_data.uuid }}'
postKubeadmCommands:
- kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f https://docs.projectcalico.org/v3.9/manifests/calico.yaml
files:
- path: /konfigadm.yml
owner: root:root
permissions: "0640"
content: |
kubernetes:
version: 1.17.3
container_runtime:
type: docker
---
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3
kind: Metal3MachineTemplate