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

Script is not running with 10. addresses. #196

Closed Andre15711 closed 1 year ago

Andre15711 commented 1 year ago

Expected Behavior

during deployment an error occurred in k3s/master task

Current Behavior

deployment stopped

Steps to Reproduce

everytime.

Context (variables)

all.yml

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

# Set your timezone
system_timezone: "Europe/Berlin"

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

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

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

# 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 }}"

# these arguments are recommended for servers as well as agents:
extra_args: >-
  --flannel-iface={{ flannel_iface }}
  --node-ip={{ k3s_node_ip }}

# change these to your liking, the only required are: --disable servicelb, --tls-san {{ apiserver_endpoint }}
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
extra_agent_args: >-
  {{ extra_args }}

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

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

# metallb ip range for load balancer
metal_lb_ip_range: "10.10.100.80-10.10.100.89"

Operating system: Ubuntu 22.04

Hardware: VM

Hosts

host.ini

[master]
10.10.100.171
10.10.100.172
10.10.100.173

[node]
10.10.100.174
10.10.100.175
10.10.100.176

[k3s_cluster:children]
master
node

Possible Solution

I includes in the IP address fix int the script without variable.

https://github.com/techno-tim/k3s-ansible/blob/e98e3ee77c7a07ed5ff1ab4588f394462c70b20f/roles/k3s/master/tasks/main.yml#L121

timothystewart6 commented 1 year ago

?

timothystewart6 commented 1 year ago

can you please fill out the template?

Andre15711 commented 1 year ago

Sorry, for the confision. If you mark the line in the code directly in GitHub and select via right mouse click "open an issue", these is no template.....

timothystewart6 commented 1 year ago

All good! Do you mean that it is "not" working with 10. addresses? By chance do you have the error from the logs?

acdoussan commented 1 year ago

I just ran this with 10.* addresses and it worked fine.

$ kubectl describe service nginx      
Name:                     nginx
Namespace:                default
Labels:                   <none>
Annotations:              <none>
Selector:                 app=nginx
Type:                     LoadBalancer
IP Family Policy:         PreferDualStack
IP Families:              IPv4
IP:                       10.43.5.3
IPs:                      10.43.5.3
LoadBalancer Ingress:     10.0.3.1
Port:                     <unset>  80/TCP
TargetPort:               80/TCP
NodePort:                 <unset>  30932/TCP
Endpoints:                <none>
Session Affinity:         None
External Traffic Policy:  Cluster
Events:
  Type    Reason       Age   From                Message
  ----    ------       ----  ----                -------
  Normal  IPAllocated  8s    metallb-controller  Assigned IP ["10.0.3.1"]
[master]
10.0.0.11
10.0.0.12
10.0.0.13

[node]
10.0.0.14
10.0.0.15
10.0.0.16

[k3s_cluster:children]
master
node
metal_lb_ip_range: "10.0.3.1-10.0.3.255"

One thing worth noting is that when I go to http://10.0.3.1 in the browser I get a timeout with nothing displayed. Similar thing happens when running curl. Might have missed some setup though, I am using pfsense, and am on the same vlan.