vrovachev | bc2f5ce | 2017-05-22 19:37:24 +0400 | [diff] [blame^] | 1 | {% from 'virtual-mcp11-k8s-calico/underlay.yaml' import HOSTNAME_CTL02 with context %} |
| 2 | |
| 3 | # Clone virtlet project from git to the ctl01 node for start virtlet pod from yaml |
| 4 | - description: Cloning virtlet project on ctl02 |
| 5 | cmd: git clone -b master https://github.com/Mirantis/virtlet.git |
| 6 | node_name: {{ HOSTNAME_CTL02 }} |
| 7 | retry: {count: 1, delay: 1} |
| 8 | skip_fail: false |
| 9 | |
| 10 | # Add 'virtlet' label for ctl02 |
| 11 | - description: Adding virtlet label for ctl02 |
| 12 | cmd: kubectl label node ctl02 extraRuntime=virtlet |
| 13 | node_name: {{ HOSTNAME_CTL02 }} |
| 14 | retry: {count: 1, delay: 1} |
| 15 | skip_fail: false |
| 16 | |
| 17 | # Add extra parameter for kubelet service on virtlet node |
| 18 | - description: Adding extra parameter for kubelet service on virtlet node |
| 19 | cmd: sed -i.bak "s|^\"|--feature-gates=DynamicKubeletConfig=true \\\\\\n\"|" /etc/default/kubelet |
| 20 | node_name: {{ HOSTNAME_CTL02 }} |
| 21 | retry: {count: 1, delay: 1} |
| 22 | skip_fail: false |
| 23 | |
| 24 | # Restart kubelet and kube-api services on virtlet node |
| 25 | - description: Restart kubelet and kube-api services on ctl02 |
| 26 | cmd: systemctl restart kube-apiserver kubelet |
| 27 | node_name: {{ HOSTNAME_CTL02 }} |
| 28 | retry: {count: 1, delay: 1} |
| 29 | skip_fail: false |
| 30 | |
| 31 | # Create virtlet pod |
| 32 | - description: Creating virtlet pod |
| 33 | cmd: kubectl create -f virtlet/deploy/virtlet-ds.yaml |
| 34 | node_name: {{ HOSTNAME_CTL02 }} |
| 35 | retry: {count: 1, delay: 1} |
| 36 | skip_fail: false |
| 37 | |
| 38 | # Virtlet pod will likely stay in Init:0/1 state because there's a problem |
| 39 | # with automatic kubelet restart after applying the configmap. |
| 40 | # As of now, you'll need to restart kubelet after ~30-60 seconds. |
| 41 | - description: Restarting kubelet service on virtlet node |
| 42 | cmd: | |
| 43 | COUNTER=0 |
| 44 | while [[ $(kubectl get pods -n kube-system | awk '/virtlet/{print $3}') != 'Init:0/1' ]]; do |
| 45 | COUNTER=$((COUNTER+1)) |
| 46 | sleep 5 |
| 47 | if [[ $COUNTER -eq 36 ]]; then |
| 48 | echo "We havenot Init:0/1 state for virtlet pod. Aborting."; |
| 49 | exit 1 |
| 50 | fi |
| 51 | done |
| 52 | sleep 60 |
| 53 | systemctl restart kubelet |
| 54 | node_name: {{ HOSTNAME_CTL02 }} |
| 55 | retry: {count: 1, delay: 1} |
| 56 | skip_fail: false |
| 57 | |
| 58 | # Wait Active state for virtlet pod |
| 59 | - description: Waiting 'Active' state for virtlet pod |
| 60 | cmd: | |
| 61 | COUNTER=0 |
| 62 | while [[ $(kubectl get pods -n kube-system | awk '/virtlet/{print $3}') != 'Running' ]]; do |
| 63 | COUNTER=$((COUNTER+1)) |
| 64 | sleep 5 |
| 65 | if [[ $COUNTER -eq 36 ]]; then |
| 66 | echo "We havenot Active state for virtlet pod. Aborting."; |
| 67 | exit 1 |
| 68 | fi |
| 69 | done |
| 70 | node_name: {{ HOSTNAME_CTL02 }} |
| 71 | retry: {count: 1, delay: 1} |
| 72 | skip_fail: false |