Merge "Worker node deployment"
commit
3401586acc
@ -0,0 +1,10 @@
|
||||
# Site-level, phase-specific lists of hosts to generate
|
||||
# This is used by the hostgenerator-m3 function to narrow down the site-level
|
||||
# host-catalogue to just the hosts needed for a particular phase.
|
||||
apiVersion: airshipit.org/v1alpha1
|
||||
kind: VariableCatalogue
|
||||
metadata:
|
||||
name: host-generation-catalogue
|
||||
hosts:
|
||||
m3:
|
||||
- node03
|
@ -0,0 +1,9 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- ../../../../../function/hostgenerator-m3
|
||||
- ../../../shared/catalogues/
|
||||
- host-generation.yaml
|
||||
|
||||
transformers:
|
||||
- ../../../../../function/hostgenerator-m3/replacements
|
@ -0,0 +1,48 @@
|
||||
apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3
|
||||
kind: KubeadmConfigTemplate
|
||||
metadata:
|
||||
name: worker-1
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
joinConfiguration:
|
||||
nodeRegistration:
|
||||
name: '{{ ds.meta_data.name }}'
|
||||
kubeletExtraArgs:
|
||||
node-labels: 'metal3.io/uuid={{ ds.meta_data.uuid }},node-type=worker'
|
||||
provider-id: 'metal3://{{ ds.meta_data.uuid }}'
|
||||
feature-gates: "IPv6DualStack=true"
|
||||
ntp:
|
||||
enabled: true
|
||||
servers:
|
||||
- 135.188.34.124
|
||||
- 135.38.244.16
|
||||
- 135.188.34.84
|
||||
preKubeadmCommands:
|
||||
- echo 'root:r00tme' | chpasswd
|
||||
- echo 'ubuntu:r00tme' | chpasswd
|
||||
- |
|
||||
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.18.6-00 kubeadm=1.18.6-00
|
||||
- apt-mark hold kubelet kubeadm
|
||||
- systemctl mask ntp
|
||||
- systemctl enable --now systemd-timesyncd
|
||||
users:
|
||||
- name: deployer
|
||||
sshAuthorizedKeys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDK5jnOafJwnoN+vp77LgayzLZ7O6tu96cObzwjIEwOowi2KHTk+G4sUXzE4mt2QbPTbyOF45d/omcRZYixrTmYwwtJ9QGPbwWw/qpCRzVo5uV4qbwBd3iRUqXryOmZRCCFac678JXZS9f8AfOP9rHkh2jqhA6dJdtvqYTOpPLtmw8pYjScH/YqBXZObNSFS5PlSPl901UhZH4FNUAuYeR9JGY99wgM+R9XHRRgfBPJzwzvOQ7ZYfvxb+n4TuBr7u7jZtYC+pmG/eOYbIt2/vexO0y/rNomtC+hjDAXZO2VFwHejYW6r+ZPpkNrdr+5U8s0aENGg4BJkVa2n3LwUrZF segorov@node1
|
||||
sudo: ALL=(ALL) NOPASSWD:ALL
|
@ -0,0 +1,7 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- nodes
|
||||
- kubeadmconfigtemplate.yaml
|
||||
- metal3machinetemplate.yaml
|
||||
- machinedeployment.yaml
|
@ -0,0 +1,29 @@
|
||||
apiVersion: cluster.x-k8s.io/v1alpha3
|
||||
kind: MachineDeployment
|
||||
metadata:
|
||||
name: worker-1
|
||||
labels:
|
||||
cluster.x-k8s.io/cluster-name: target-cluster
|
||||
spec:
|
||||
clusterName: target-cluster
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
cluster.x-k8s.io/cluster-name: target-cluster
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
cluster.x-k8s.io/cluster-name: target-cluster
|
||||
spec:
|
||||
clusterName: target-cluster
|
||||
version: v1.18.3
|
||||
bootstrap:
|
||||
configRef:
|
||||
name: worker-1
|
||||
apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3
|
||||
kind: KubeadmConfigTemplate
|
||||
infrastructureRef:
|
||||
name: worker-1
|
||||
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3
|
||||
kind: Metal3MachineTemplate
|
||||
---
|
@ -0,0 +1,10 @@
|
||||
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3
|
||||
kind: Metal3MachineTemplate
|
||||
metadata:
|
||||
name: worker-1
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
image:
|
||||
url: http://10.23.24.1:8099/target-image.qcow2
|
||||
checksum: http://10.23.24.1:8099/target-image.qcow2.md5sum
|
@ -0,0 +1,8 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
generators:
|
||||
- ../hostgenerator
|
||||
|
||||
commonLabels:
|
||||
airshipit.org/k8s-role: controlplane-host
|
@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -xe
|
||||
|
||||
#Default wait timeout is 3600 seconds
|
||||
export TIMEOUT=${TIMEOUT:-3600}
|
||||
export KUBECONFIG=${KUBECONFIG:-"$HOME/.airship/kubeconfig"}
|
||||
|
||||
echo "Switch context to target cluster and set manifest"
|
||||
airshipctl config use-context target-cluster-admin@target-cluster
|
||||
airshipctl config set-context target-cluster-admin@target-cluster --manifest dummy_manifest
|
||||
|
||||
echo "Stop ephemeral node"
|
||||
sudo virsh destroy air-ephemeral
|
||||
|
||||
echo "Deploy worker node"
|
||||
airshipctl phase apply workers --debug
|
||||
|
||||
#Wait till node is created
|
||||
end=$(($(date +%s) + $TIMEOUT))
|
||||
echo "Waiting $TIMEOUT seconds for node to be provisioned."
|
||||
while true; do
|
||||
if (kubectl --request-timeout 20s --kubeconfig $KUBECONFIG get node node03 | grep -qw Ready) ; then
|
||||
echo -e "\nGet node status"
|
||||
kubectl --kubeconfig $KUBECONFIG get node
|
||||
break
|
||||
else
|
||||
now=$(date +%s)
|
||||
if [ $now -gt $end ]; then
|
||||
echo -e "\nWorker node is not ready before TIMEOUT."
|
||||
exit 1
|
||||
fi
|
||||
echo -n .
|
||||
sleep 15
|
||||
fi
|
||||
done
|
Loading…
Reference in New Issue