githubixx.flanneld
Ansible Role for Flanneld
This Ansible playbook is used to set up and configure the flanneld
binary, which is part of Kubernetes. Flannel provides a layer 3 IPv4 network for different nodes in a cluster. It manages how traffic moves between hosts but not how containers connect to the host. Flannel also includes a CNI plugin for Kubernetes and offers guidance on integrating with Docker.
Versions
Every release is tagged, and I follow semantic versioning. I recommend using the latest tag for the role. The main branch is for development, and tags indicate stable releases. For example, 8.0.0+0.16.1
shows that this role is version 8.0.0
designed for Flannel version 0.16.1
(it might work with newer versions as well). If the role updates, the part before +
will increase. If the Flannel version changes, the part after +
will increase. This way, I can tag bug fixes and major updates while still developing for a specific Flannel version.
Requirements
- A running
etcd
cluster (see ansible-role-etcd). The role connects to the first node in Ansible'sk8s_etcd
group to add a new entry inetcd
with the Flannel network configuration located at "flannel_etcd_prefix
/config". - CNI plugins (see ansible-role-cni).
Changelog
Check the CHANGELOG.md for updates.
Role Variables
Here are some key variables you can set:
k8s_interface: "tap0" # The interface for K8s services
k8s_conf_dir: "/var/lib/kubernetes" # Directory for K8s configuration
k8s_cni_conf_dir: "/etc/cni/net.d" # CNI plugin directory
k8s_ca_conf_directory: "{{ '~/k8s/certs' | expanduser }}" # Directory for K8s certificates
flannel_version: "v0.16.1" # Flannel version
flannel_etcd_prefix: "/kubernetes-cluster/network" # etcd path for Flannel settings
flannel_ip_range: "10.200.0.0/16" # IP range for Flannel
flannel_backend_type: "vxlan" # Backend type for Flannel
flannel_cni_interface: "cni0" # CNI interface name
You can override flannel_settings
by creating a variable called flannel_settings_user
to add or modify settings.
Important Note
There's a commented-out directive, flannel_systemd_execstartpost: "/sbin/ethtool -K flannel.1 tx off"
. If Pod-to-Pod communication works but Pod-to-Service or Node-to-Service doesn’t, enabling this may help, especially on Hetzner cloud. It addresses a checksum issue with traffic.
Dependencies
etcd
(see ansible-role-etcd)CNI plugins
(see ansible-role-cni or other roles that install CNI plugins)
Example Playbook
You can use this example to run the playbook:
- hosts: flannel
roles:
- githubixx.flanneld
License
This work is licensed under the GNU GENERAL PUBLIC LICENSE Version 3.
Author Information
For more information, visit http://www.tauceti.blog.
Installs flanneld (for Kubernetes)
ansible-galaxy install githubixx.flanneld