| - name: Install Kubernetes dependencies |
| - name: Get apt signing key from Google Cloud |
| url: https://packages.cloud.google.com/apt/doc/apt-key.gpg |
| - name: Add Kubernetes apt repository |
| repo: 'deb http://apt.kubernetes.io/ kubernetes-xenial main' |
| - name: Install Kubernetes |
| - kubernetes-cni=0.6.0-00 |
| - name: Initialize node as Kubernetes master |
| command: "kubeadm init --pod-network-cidr=192.168.0.0/16 --apiserver-advertise-address=10.100.198.220" |
| - name: Create .kube directory under home |
| - name: Copy config to home directory |
| command: "sudo cp /etc/kubernetes/admin.conf /home/ubuntu/.kube/config" |
| - name: Change ownership of ~/.kube/config |
| path: /home/ubuntu/.kube/config |
| - name: Set proxy-mode flag in kube-proxy daemonset (workaround for https://github.com/kubernetes/kubernetes/issues/34101) |
| shell: "kubectl --kubeconfig=/etc/kubernetes/admin.conf -n kube-system get ds -l 'k8s-app==kube-proxy' -o json | jq '.items[0].spec.template.spec.containers[0].command |= .+ [\"--proxy-mode=userspace\"]' | kubectl --kubeconfig=/etc/kubernetes/admin.conf apply -f - && kubectl --kubeconfig=/etc/kubernetes/admin.conf -n kube-system delete pods -l 'k8s-app==kube-proxy'" |
| - name: Allow workloads on Kubernetes master |
| command: "kubectl --kubeconfig=/etc/kubernetes/admin.conf taint nodes --all node-role.kubernetes.io/master-" |
| - name: Install pod network |
| command: "kubectl --kubeconfig=/etc/kubernetes/admin.conf apply -f /cord/incubator/voltha/k8s/calico-1.6.yml" |