techno-tim / k3s-ansible

The easiest way to bootstrap a self-hosted High Availability Kubernetes cluster. A fully automated HA k3s etcd install with kube-vip, MetalLB, and more. Build. Destroy. Repeat.
https://technotim.live/posts/k3s-etcd-ansible/
Apache License 2.0
2.41k stars 1.05k forks source link

update errors #115

Closed darkcloud784 closed 1 year ago

darkcloud784 commented 2 years ago

Expected Behavior

Run playbook, it either updates the cluster k3s/metallb/kubevip install or installs it new

Current Behavior

Master nodes seem fine but agents get the following error when starting: level=fatal msg="parse \"https://{{\": invalid character \"{\" in host name"

Steps to Reproduce

  1. setup servers
  2. run script
  3. wait
  4. look at logs

Context (variables)

Ubuntu 22.04 Jammy

Operating system:

Hardware:

KVM virtual cluster

Variables Used

---
k3s_version: v1.24.4+k3s1
# this is the user that has ssh access to these machines
ansible_user: darkcloud
systemd_dir: /etc/systemd/system

# Set your timezone
system_timezone: "America/Chicago"

# interface which will be used for flannel
flannel_iface: "ens18"

# apiserver_endpoint is virtual ip-address which will be configured on each master
apiserver_endpoint: "192.168.86.189"

# k3s_token is required  masters can talk together securely
# this token should be alpha numeric only
k3s_token: "mysupersecretstuff"

# The IP on which the node is reachable in the cluster.
# Here, a sensible default is provided, you can still override
# it for each of your hosts, though.
k3s_node_ip: '{{ ansible_facts[flannel_iface]["ipv4"]["address"] }}'

# Disable the taint manually by setting: k3s_master_taint = false
k3s_master_taint: "{{ true if groups['node'] | default([]) | length >= 1 else false }}"

# change these to your liking, the only required one is--no-deploy servicelb
extra_args: >-
  --flannel-iface={{ flannel_iface }}
  --node-ip={{ k3s_node_ip }}

extra_server_args: >-
  {{ extra_args }}
  {{ '--node-taint node-role.kubernetes.io/master=true:NoSchedule' if k3s_master_taint else '' }}
  --tls-san {{ apiserver_endpoint }}
  --disable servicelb
  --disable traefik
  --kube-apiserver-arg default-not-ready-toleration-seconds=30
  --kube-apiserver-arg default-unreachable-toleration-seconds=30
  --kube-controller-arg node-monitor-period=20s

extra_agent_args: >-
  {{ extra_args }}

# image tag for kube-vip
kube_vip_tag_version: "v0.5.0"

# image tag for metal lb
metal_lb_speaker_tag_version: "v0.13.5"
metal_lb_controller_tag_version: "v0.13.5"

# metallb ip range for load balancer
metal_lb_ip_range: "192.168.86.150-192.168.86.180"

Hosts

host.ini

[master]
192.168.86.190
192.168.86.191
192.168.86.192
192.168.86.197

[node]
192.168.86.193
192.168.86.194
192.168.86.195
192.168.86.196

[k3s_cluster:children]
master
node

Possible Solution