Skip to content

Commit

Permalink
Update Kubernetes-setup-using-Ansible-and-Vagrant.md
Browse files Browse the repository at this point in the history
Fix a node IP issue when using vagrant.
See kubernetes/kubernetes#60835 for detail.

Since the tutorial using debs, we need to configure node IP in `/etc/default/kubelet`. 
See https://kubernetes.io/docs/setup/independent/kubelet-integration/ for detail.
  • Loading branch information
halfcrazy committed Apr 24, 2019
1 parent 3c4a42b commit a64edb8
Showing 1 changed file with 16 additions and 0 deletions.
Expand Up @@ -47,6 +47,9 @@ Vagrant.configure("2") do |config|
master.vm.hostname = "k8s-master"
master.vm.provision "ansible" do |ansible|
ansible.playbook = "kubernetes-setup/master-playbook.yml"
ansible.extra_vars = {
node_ip: "192.168.50.10",
}
end
end

Expand All @@ -57,6 +60,9 @@ Vagrant.configure("2") do |config|
node.vm.hostname = "node-#{i}"
node.vm.provision "ansible" do |ansible|
ansible.playbook = "kubernetes-setup/node-playbook.yml"
ansible.extra_vars = {
node_ip: "192.168.50.#{i + 10}",
}
end
end
end
Expand Down Expand Up @@ -162,6 +168,16 @@ We will be installing the following packages, and then adding a user named “va
- kubelet
- kubeadm
- kubectl
- name: Configure node ip
lineinfile:
path: /etc/default/kubelet
line: KUBELET_EXTRA_ARGS=--node-ip={{ node_ip }}

- name: Restart kubelet
service:
name: kubelet
daemon_reload: yes
state: restarted
```

#### Step 2.3: Initialize the Kubernetes cluster with kubeadm using the below code (applicable only on master node).
Expand Down

0 comments on commit a64edb8

Please sign in to comment.