blob: 4f2abb3a11bc07e4aaf5dc440575b8d78a18de1e [file] [log] [blame]
{% from 'virtual-mcp11-k8s-calico/underlay.yaml' import HOSTNAME_CTL02 with context %}
# Clone virtlet project from git to the ctl01 node for start virtlet pod from yaml
- description: Cloning virtlet project on ctl02
cmd: git clone -b master https://github.com/Mirantis/virtlet.git
node_name: {{ HOSTNAME_CTL02 }}
retry: {count: 1, delay: 1}
skip_fail: false
# Add 'virtlet' label for ctl02
- description: Adding virtlet label for ctl02
cmd: kubectl label node ctl02 extraRuntime=virtlet
node_name: {{ HOSTNAME_CTL02 }}
retry: {count: 1, delay: 1}
skip_fail: false
# Add extra parameter for kubelet service on virtlet node
- description: Adding extra parameter for kubelet service on virtlet node
cmd: sed -i.bak "s|^\"|--feature-gates=DynamicKubeletConfig=true \\\\\\n\"|" /etc/default/kubelet
node_name: {{ HOSTNAME_CTL02 }}
retry: {count: 1, delay: 1}
skip_fail: false
# Restart kubelet and kube-api services on virtlet node
- description: Restart kubelet and kube-api services on ctl02
cmd: systemctl restart kube-apiserver kubelet
node_name: {{ HOSTNAME_CTL02 }}
retry: {count: 1, delay: 1}
skip_fail: false
# Create virtlet pod
- description: Creating virtlet pod
cmd: kubectl create -f virtlet/deploy/virtlet-ds.yaml
node_name: {{ HOSTNAME_CTL02 }}
retry: {count: 1, delay: 1}
skip_fail: false
# Virtlet pod will likely stay in Init:0/1 state because there's a problem
# with automatic kubelet restart after applying the configmap.
# As of now, you'll need to restart kubelet after ~30-60 seconds.
- description: Restarting kubelet service on virtlet node
cmd: |
COUNTER=0
while [[ $(kubectl get pods -n kube-system | awk '/virtlet/{print $3}') != 'Init:0/1' ]]; do
COUNTER=$((COUNTER+1))
sleep 5
if [[ $COUNTER -eq 36 ]]; then
echo "We havenot Init:0/1 state for virtlet pod. Aborting.";
exit 1
fi
done
sleep 60
systemctl restart kubelet
node_name: {{ HOSTNAME_CTL02 }}
retry: {count: 1, delay: 1}
skip_fail: false
# Wait Active state for virtlet pod
- description: Waiting 'Active' state for virtlet pod
cmd: |
COUNTER=0
while [[ $(kubectl get pods -n kube-system | awk '/virtlet/{print $3}') != 'Running' ]]; do
COUNTER=$((COUNTER+1))
sleep 5
if [[ $COUNTER -eq 36 ]]; then
echo "We havenot Active state for virtlet pod. Aborting.";
exit 1
fi
done
node_name: {{ HOSTNAME_CTL02 }}
retry: {count: 1, delay: 1}
skip_fail: false