Ansible role to deploy Kubernetes with Rancher Kubernetes Engine.
Building and improving this Ansible role have been sponsored by my current and previous employers like Cloudpunks GmbH and Proact Deutschland GmbH.
- Requirements
- Default Variables
- rke_addon_default
- rke_addon_extra
- rke_auth_mode
- rke_auth_sans
- rke_auth_strategy
- rke_backup_enabled
- rke_backup_interval
- rke_backup_retention
- rke_binary_download
- rke_binary_version
- rke_cluster_name
- rke_config_dir
- rke_config_group
- rke_config_mode
- rke_config_owner
- rke_controller_config
- rke_copy_kubeconfig
- rke_dns_config
- rke_enable_cri_dockerd
- rke_etcd_config
- rke_external_domain
- rke_force_update
- rke_ignore_docker_version
- rke_images_config
- rke_ingress_config
- rke_kubeapi_config
- rke_kubelet_config
- rke_kubeproxy_config
- rke_kubernetes_support
- rke_kubernetes_version
- rke_monitoring_config
- rke_network_options
- rke_network_password
- rke_network_plugin
- rke_nodes_config
- rke_provider_config
- rke_registries_config
- rke_s3_access
- rke_s3_bucket
- rke_s3_endpoint
- rke_s3_folder
- rke_s3_region
- rke_s3_secret
- rke_scheduler_config
- Discovered Tags
- Dependencies
- License
- Author
- Minimum Ansible version:
2.10
List of default addons to install
rke_addon_default: []
rke_addon_default:
- url: https://raw.githubusercontent.com/rook/rook/master/cluster/examples/kubernetes/ceph/operator.yaml
- name: example
content:
apiVersion: v1
kind: Service
metadata:
name: example
namespace: kube-system
spec:
ports:
- name: http
port: 8080
selector:
app.kubernetes.io/example
- name: dummy
state: absent
List of extra addons to install
rke_addon_extra: []
rke_addon_extra:
- url: https://raw.githubusercontent.com/rook/rook/master/cluster/examples/kubernetes/ceph/operator.yaml
- name: example
content:
apiVersion: v1
kind: Service
metadata:
name: example
namespace: kube-system
spec:
ports:
- name: http
port: 8080
selector:
app.kubernetes.io/example
- name: dummy
state: absent
Authorization mode
rke_auth_mode: rbac
List of SANs for the Kubernetes API
rke_auth_sans: []
rke_auth_sans:
- 192.168.1.254
- kubernetes.example.com
Authentication strategy
rke_auth_strategy: x509
Enable etcd backups
rke_backup_enabled: false
Interval for etcd backups
rke_backup_interval: 24
Retention for etcd backups
rke_backup_retention: 7
URL to download the release binary
rke_binary_download: https://github.com/rancher/rke/releases/download/v{{ rke_binary_version
}}/rke_linux-amd64
Version of the RKE release to use
rke_binary_version: 1.4.8
Name of the Kubernetes cluster
rke_cluster_name:
Path to for configuration and state
rke_config_dir: /etc/rke
rke_config_group: root
rke_config_mode: u=rw,g=r,o=
Owner of the copied kubeconfig
rke_config_owner: root
rke_controller_config:
Copy kubeconfig to these nodes
rke_copy_kubeconfig: []
rke_copy_kubeconfig:
- master-01
- master-02
- master-03
DNS configuration
rke_dns_config:
provider: coredns
nodelocal:
ip_address: 169.254.20.10
upstreamnameservers:
- 1.1.1.1
- 8.8.8.8
Ignore unsupported Docker versions
rke_enable_cri_dockerd: false
Scheduler configuration
rke_etcd_config:
External domain to override copied kubeconfigs
rke_external_domain:
Force cluster update even without config changes
rke_force_update: false
rke_ignore_docker_version: false
System images configuration
rke_images_config:
rke_images_config:
etcd: rancher/coreos-etcd:v3.2.24
alpine: rancher/rke-tools:v0.1.24
nginx_proxy: rancher/rke-tools:v0.1.24
Ingress configuration
rke_ingress_config:
provider: nginx
dns_policy: ClusterFirstWithHostNet
rke_kubeapi_config:
always_pull_images: true
audit_log:
enabled: true
secrets_encryption_config:
enabled: true
rke_kubelet_config:
rke_kubeproxy_config:
Mapping for supported Kubernetes versions
rke_kubernetes_support:
'1.17': v1.17.17-rancher2-4
'1.18': v1.18.20-rancher1-3
'1.19': v1.19.16-rancher2-1
'1.20': v1.20.15-rancher2-2
'1.21': v1.21.14-rancher1-1
'1.22': v1.22.17-rancher1-2
'1.23': v1.23.16-rancher2-3
'1.24': v1.24.16-rancher1-1
'1.25': v1.25.12-rancher1-1
'1.26': v1.26.7-rancher1-1
Kubernetes version to install
rke_kubernetes_version: '1.26'
Monitoring configuration
rke_monitoring_config:
provider: metrics-server
Network options
rke_network_options:
Weave password
rke_network_password: p455w0rd
Network plugin
rke_network_plugin: weave
Nodes configuration
rke_nodes_config:
rke_nodes_config: |
{% for node in groups['server'] %}
- hostname_override: {{ node }}
address: {{ hostvars[host]['ansible_host'] }}
user: rke
role:
- controlplane
- etcd
{% endfor %}
{% for node in groups['worker'] %}
- hostname_override: {{ node }}
address: {{ hostvars[host]['ansible_host'] }}
user: rke
role:
- worker
{% endfor %}
Cloud provider configuration
rke_provider_config:
System images configuration
rke_registries_config:
rke_registries_config:
- url: registry.example.com
user: username
password: p455w0rd
- url: registry.foobar.com
user: username
password: p455w0rd
is_default: True
Backup S3 access key
rke_s3_access:
Backup S3 bucket
rke_s3_bucket:
Backup S3 endpoint
rke_s3_endpoint:
Backup S3 folder
rke_s3_folder:
Backup S3 region
rke_s3_region:
Backup S3 secret key
rke_s3_secret:
rke_scheduler_config:
rke
skip_ansible_later
- None
Apache-2.0