lab:stack_-_install_haproxy
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
lab:stack_-_install_haproxy [2023/05/01 01:38] – updated user | lab:stack_-_install_haproxy [2023/05/01 19:48] (current) – replaced user | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Install HAProxy ====== | ||
- | In our previous step we deployed a web app to Kubernetes on our [[Stack of NUCs]]. | ||
- | |||
- | Now we are going to install HAProxy. | ||
- | |||
- | Purpose: | ||
- | * Demonstrate a using HAProxy in front of a web application on Kubernetes | ||
- | |||
- | References | ||
- | * [[https:// | ||
- | |||
- | ====== Step 1 - Connect to the Ansible control node ====== | ||
- | From [[stack - nuc 1|NUC 1]], log in to the Ansible control node, [[stack - nuc 2|NUC 2]]. | ||
- | |||
- | ====== Step 2 - Set Up a Folder for Configuration and Playbooks ====== | ||
- | - Create folder ''/ | ||
- | - Copy the '' | ||
- | * '' | ||
- | - Create the file ''/ | ||
- | * <file yaml ansible.cfg> | ||
- | [defaults] | ||
- | inventory | ||
- | </ | ||
- | - Create the file ''/ | ||
- | * <file yaml haproxy.cfg.j2> | ||
- | # ------------------------ | ||
- | # main frontend which proxys to the backends | ||
- | # ------------------------ | ||
- | frontend main | ||
- | bind *:8080 | ||
- | acl url_static | ||
- | acl url_static | ||
- | |||
- | use_backend static | ||
- | default_backend app | ||
- | # ------------------------ | ||
- | # static backend for serving up images, stylesheets and such | ||
- | # ------------------------ | ||
- | backend static | ||
- | balance roundrobin | ||
- | server | ||
- | # ------------------------ | ||
- | # round robin balancing between the various backends | ||
- | # ------------------------ | ||
- | backend app | ||
- | balance roundrobin | ||
- | {% for ip in groups[' | ||
- | server app{{ loop.index}} {{ ip }}:80 check | ||
- | {% endfor %} | ||
- | </ | ||
- | ====== Step 3 - Install HAProxy ====== | ||
- | |||
- | <file yaml haproxy-install.yml> | ||
- | --- | ||
- | - hosts: nodes | ||
- | tasks: | ||
- | - name: Install haproxy | ||
- | package: | ||
- | name: haproxy | ||
- | state: present | ||
- | - name: Configure haproxy.cfg file | ||
- | template: | ||
- | src: "/ | ||
- | dest: "/ | ||
- | - name: " | ||
- | service: | ||
- | name: haproxy | ||
- | state: restarted | ||
- | </ | ||
- | |||
- | '' | ||
- | |||
lab/stack_-_install_haproxy.1682905101.txt.gz · Last modified: 2023/05/01 01:38 by user