[Kubernetes] Make HA master setup compatible with SONiC buildimage join process#2306
Conversation
| become: yes | ||
| fetch: | ||
| src: /etc/kubernetes/admin.conf | ||
| dest: /tmp/helper/admin.conf |
There was a problem hiding this comment.
/tmp/helper/ [](start = 10, length = 12)
Why not set dest to /var/www/html directly? #Closed
There was a problem hiding this comment.
This saves the file to host server so that the file can be transferred from one VM to another VM. init_master_leader.yml is running on Master1 VM, but I need the file on the HAProxy VM
There was a problem hiding this comment.
Then you may remove this fetch completely, and use below copy with src as /etc/kubernetes/admin.conf ?
In reply to: 508867244 [](ancestors = 508867244)
There was a problem hiding this comment.
Then I get this error:
"Could not find or access '/etc/kubernetes/admin.conf' on the Ansible Controller. When I wrote the original code I also thought there would be a more straightforward way to copy the file from one VM to another, but using the /tmp directory was the only way I tried that worked for me
There was a problem hiding this comment.
I understand now. Please give correct comments, especially on the src/dest machines.
In reply to: 508884204 [](ancestors = 508884204,508867244)
There was a problem hiding this comment.
To clarify, I get that error because the /etc/kubernetes/admin.conf is on the server, not on the VM.
For fetch module:
srcis the master VM, on which/etc/kubernetes/admin.confis presentdestis the server
For copy module:
srcis the serverdestis the HAProxy VM
| copy: | ||
| src: /tmp/helper/admin.conf | ||
| dest: /var/www/html/admin.conf | ||
| mode: '777' |
There was a problem hiding this comment.
777 [](start = 11, length = 3)
Everyone can write or del it, is it safe? #Closed
There was a problem hiding this comment.
I changed to 755 permissions. This was the most restrictive I could make it while ensuring that the SONiC DUT could still download the file properly. This is also in-line with the response here https://askubuntu.com/questions/451922/apache-access-denied-because-search-permissions-are-missing
| file: | ||
| path: "/var/www/html" | ||
| state: directory | ||
| mode: '777' |
There was a problem hiding this comment.
777 [](start = 11, length = 3)
Is it too broad permission? #Closed
There was a problem hiding this comment.
I changed to 755 permissions. This was the most restrictive I could make it while ensuring that the SONiC DUT could still download the file properly. This is also in-line with the response here https://askubuntu.com/questions/451922/apache-access-denied-because-search-permissions-are-missing
| src: "default-ssl.conf.j2" | ||
| dest: "/etc/apache2/sites-available/default-ssl.conf" | ||
|
|
||
| - name: Enable Apaache SSL |
There was a problem hiding this comment.
Apaache [](start = 15, length = 7)
typo? #Closed
|
|
||
| - name: Initializing Kubernetes cluster | ||
| shell: kubeadm init --control-plane-endpoint {{ haproxy_ip }}:80 --upload-certs --apiserver-advertise-address {{ ansible_ens2.ipv4.address }} --skip-phases=addon/kube-proxy --skip-phases=addon/coredns --ignore-preflight-errors=NumCPU | ||
| shell: kubeadm init --control-plane-endpoint {{ haproxy_ip }}:{{ k8s_port }} --upload-certs --apiserver-advertise-address {{ ansible_ens2.ipv4.address }} --skip-phases=addon/kube-proxy --skip-phases=addon/coredns |
There was a problem hiding this comment.
beadm init --control-plane-endpoint {{ haproxy_ip }}:{{ k8 [](start = 11, length = 58)
This line is too long to read. Could you split? #Closed
|
retest vsimage please |
Including change: * 7ff8f75 2022-06-03 | Revert "[portsorch]: Prevent LAG member configuration when port has active ACL binding (sonic-net#2165)" (sonic-net#2306) (HEAD -> 202205, github/202205) [bingwang-ms] Signed-off-by: Ying Xie <ying.xie@microsoft.com>
Description of PR
Summary:
Make HA master setup compatible with automated SONiC buildimage join process
Approach
What is the motivation for this PR?
The current SONiC buildimage assumes the Kubernetes conf file is available at HTTP server on master; this conf file is used to join the SONiC worker node to the Kubernetes master. Previously, the HA testbed master expected SONiC worker nodes to join manually via a command output during master initialization. This PR allows automated join of the SONiC DUT to the HA Kubernetes master by downloading the necessary conf file from a new HTTP server hosted at the master VIP.
How did you do it?
How did you verify/test it?
testbed-cli.shscriptsudo config kube server ip <HAPROXY NODE IP/VIP>show kube serveron SONiC DUT shows master is connectedkubectl get nodeson master shows all 3 master nodes and SONiC DUT