summaryrefslogtreecommitdiffstats
path: root/k8s_cluster/templates/cloud_init_load_balancer.cfg.tpl
blob: 4d8ebae52fb06000ab029dbadae8c66a3ebdb97e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#cloud-config

users:
  - name: arch
    groups:
      - wheel
      - users
    lock_passwd: false
    passwd: $6$KHqF91TQzQNJECRV$/zMRa92BqMB5juUpKfIHbOpOdUPyNlLJTpymplTOP.uqoonD/AZzNRnA/XACZTuqyxAktuohSjXhyfskbRjbO1
    ssh_authorized_keys:
      - ${ssh_public_key}
    sudo: ALL=(ALL) NOPASSWD:ALL
packages:
  - bash-completion
  - man
  - man-pages
  - nginx
  - qemu-guest-agent
  - ripgrep
  - tmux
  - tree
  - vim
write_files:
  - content: |
      10.10.66.50 k8s
      10.10.66.100 worker0
      10.10.66.101 worker1
      10.10.66.200 controller0
      10.10.66.201 controller1
    path: /etc/hosts
    append: true
  - content: |
      worker_processes auto;
      error_log /var/log/nginx/error.log;
      events {
        worker_connections 1024;
      }
      http {
        include mime.types;
        resolver 127.0.0.1 [::1];
        default_type application/octet-stream;
        sendfile on;
        types_hash_max_size 4096;
        keepalive_requests 55;
        keepalive_timeout 55;
      }
      include conf.d/k8s_load_balancer.conf;
    path: /etc/nginx/nginx.conf
  - content: |
      stream {
        upstream k8s_apiserver {
          server controller0:6443;
          server controller1:6443;
        }
        server {
          listen 6443;
          proxy_pass k8s_apiserver;
        }
      }
    path: /etc/nginx/conf.d/k8s_load_balancer.conf
runcmd:
  - [ systemctl, enable, --now, qemu-guest-agent, nginx ]