- block: # NOTE: When create a k8s environment with devstack-plugin-container and # deploy a Pod, the following error occurred - `network: failed to set bridge # addr: "cni0" already has an IP address different from 10.x.x.x` and # the Pod fails to be deployed. As a fix, delete the related interface and # restart service. - name: k8s interface down shell: ip link set cni0 down && ip link set flannel.1 down become: yes - name: k8s interface delete shell: ip link delete cni0 && ip link delete flannel.1 become: yes - name: kubelet service restart service: name: kubelet state: restarted become: yes - name: Get coredns name shell: > kubectl get pod -n kube-system --no-headers -o custom-columns=":metadata.name" | grep coredns | tr -s '\n' ' ' register: coredns_name become: yes become_user: stack - name: Restart coredns pod shell: > kubectl delete pod -n kube-system {{ coredns_name.stdout }} become: yes become_user: stack - name: Delete existing flannel shell: > kubectl delete -f https://github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml become: yes become_user: stack - name: Restart flannel shell: > kubectl apply -f https://github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml become: yes become_user: stack when: - inventory_hostname == 'controller-k8s' - k8s_api_url is defined