Skip to content
kubeadm-config.yaml.j2 6.21 KiB
Newer Older
Matthew Mosesohn's avatar
Matthew Mosesohn committed
apiVersion: kubeadm.k8s.io/v1alpha1
kind: MasterConfiguration
api:
  advertiseAddress: {{ ip | default(ansible_default_ipv4.address) }}
  bindPort: {{ kube_apiserver_port }}
Matthew Mosesohn's avatar
Matthew Mosesohn committed
etcd:
{% for endpoint in etcd_access_addresses.split(',') %}
Matthew Mosesohn's avatar
Matthew Mosesohn committed
  - {{ endpoint }}
{% endfor %}
  caFile: {{ kube_config_dir }}/ssl/etcd/ca.pem
  certFile: {{ kube_config_dir }}/ssl/etcd/node-{{ inventory_hostname }}.pem
  keyFile: {{ kube_config_dir }}/ssl/etcd/node-{{ inventory_hostname }}-key.pem
networking:
  dnsDomain: {{ dns_domain }}
  serviceSubnet: {{ kube_service_addresses }}
  podSubnet: {{ kube_pods_subnet }}
kubernetesVersion: {{ kube_version }}
woopstar's avatar
woopstar committed
{% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere"] %}
cloud-provider: {{ cloud_provider }}
cloud-config: {{ kube_config_dir }}/cloud_config
{% elif cloud_provider is defined and cloud_provider == "aws" %}
cloud-provider: {{ cloud_provider }}
{% endif %}
{% if kube_proxy_mode == 'ipvs' %}
kubeProxy:
  config:
    featureGates: SupportIPVSProxyMode=true
    mode: ipvs
{% endif %}
authorizationModes:
Matthew Mosesohn's avatar
Matthew Mosesohn committed
{% for mode in authorization_modes %}
- {{ mode }}
{% endfor %}
selfHosted: false
apiServerExtraArgs:
  bind-address: {{ kube_apiserver_bind_address }}
Matthew Mosesohn's avatar
Matthew Mosesohn committed
  insecure-bind-address: {{ kube_apiserver_insecure_bind_address }}
  insecure-port: "{{ kube_apiserver_insecure_port }}"
  admission-control: {{ kube_apiserver_admission_control | join(',') }}
  apiserver-count: "{{ kube_apiserver_count }}"
{% if kube_version | version_compare('v1.9', '>=') %}
  endpoint-reconciler-type: lease
woopstar's avatar
woopstar committed
{% endif %}
Matthew Mosesohn's avatar
Matthew Mosesohn committed
  service-node-port-range: {{ kube_apiserver_node_port_range }}
  kubelet-preferred-address-types: "{{ kubelet_preferred_address_types }}"
woopstar's avatar
woopstar committed
  profiling: "{{ kube_profiling }}"
  enable-aggregator-routing: "{{ kube_api_aggregator_routing }}"
  repair-malformed-updates: "false"
{% if kube_api_anonymous_auth is defined and kube_version | version_compare('v1.5', '>=')  %}
  anonymous-auth: "{{ kube_api_anonymous_auth }}"
{% endif %}
{% if kube_feature_gates %}
  feature-gates: {{ kube_feature_gates|join(',') }}
{% endif %}
Matthew Mosesohn's avatar
Matthew Mosesohn committed
{% if kube_basic_auth|default(true) %}
  basic-auth-file: {{ kube_users_dir }}/known_users.csv
{% endif %}
woopstar's avatar
woopstar committed
{% if kube_token_auth|default(true) %}
  token-auth-file: {{ kube_token_dir }}/known_tokens.csv
{% endif %}
Matthew Mosesohn's avatar
Matthew Mosesohn committed
{% if kube_oidc_auth|default(false) and kube_oidc_url is defined and kube_oidc_client_id is defined %}
  oidc-issuer-url: {{ kube_oidc_url }}
  oidc-client-id: {{ kube_oidc_client_id }}
{%   if kube_oidc_ca_file is defined %}
  oidc-ca-file: {{ kube_oidc_ca_file }}
{%   endif %}
{%   if kube_oidc_username_claim is defined %}
  oidc-username-claim: {{ kube_oidc_username_claim }}
{%   endif %}
{%   if kube_oidc_groups_claim is defined %}
  oidc-groups-claim: {{ kube_oidc_groups_claim }}
{%   endif %}
{% endif %}
{% if kube_encrypt_secret_data %}
  experimental-encryption-provider-config: {{ kube_config_dir }}/ssl/secrets_encryption.yaml
Matthew Mosesohn's avatar
Matthew Mosesohn committed
{% endif %}
  storage-backend: {{ kube_apiserver_storage_backend }}
{% if kube_api_runtime_config is defined %}
  runtime-config: {{ kube_api_runtime_config | join(',') }}
Matthew Mosesohn's avatar
Matthew Mosesohn committed
{% endif %}
  allow-privileged: "true"
{% for key in kube_kubeadm_apiserver_extra_args %}
  {{ key }}: "{{ kube_kubeadm_apiserver_extra_args[key] }}"
Matthew Mosesohn's avatar
Matthew Mosesohn committed
controllerManagerExtraArgs:
  node-monitor-grace-period: {{ kube_controller_node_monitor_grace_period }}
  node-monitor-period: {{ kube_controller_node_monitor_period }}
  pod-eviction-timeout: {{ kube_controller_pod_eviction_timeout }}
woopstar's avatar
woopstar committed
  enable-hostpath-provisioner: "{{ kube_hostpath_dynamic_provisioner }}"
  profiling: "{{ kube_profiling }}"
{% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere"] %}
  cloud-provider: {{cloud_provider}}
  cloud-config: {{ kube_config_dir }}/cloud_config
{% elif cloud_provider is defined and cloud_provider in ["aws", "external"] %}
  cloud-provider: {{cloud_provider}}
{% endif %}
{% if kube_network_plugin is defined and kube_network_plugin == 'cloud' %}
  configure-cloud-routes: "true"
{% endif %}
{% if kube_network_plugin is defined and kube_network_plugin in ["cloud", "flannel", "canal", "cilium"] %}
  allocate-node-cidrs: true
  cluster-cidr: {{ kube_pods_subnet }}
  service-cluster-ip-range: {{ kube_service_addresses }}
  node-cidr-mask-size: {{ kube_network_node_prefix }}
{% endif %}
Matthew Mosesohn's avatar
Matthew Mosesohn committed
{% if kube_feature_gates %}
  feature-gates: {{ kube_feature_gates|join(',') }}
{% endif %}
{% for key in kube_kubeadm_controller_extra_args %}
  {{ key }}: "{{ kube_kubeadm_controller_extra_args[key] }}"
{% endfor %}
{% if kube_kubeadm_scheduler_extra_args|length > 0 %}
schedulerExtraArgs:
woopstar's avatar
woopstar committed
{% if volume_cross_zone_attachment %}
  policy-config-file: {{ kube_config_dir }}/kube-scheduler-policy.yaml
{% endif %}
  profiling: "{{ kube_profiling }}"
{% if kube_feature_gates %}
  feature-gates: {{ kube_feature_gates|join(',') }}
{% endif %}
{% for key in kube_kubeadm_scheduler_extra_args %}
  {{ key }}: "{{ kube_kubeadm_scheduler_extra_args[key] }}"
Matthew Mosesohn's avatar
Matthew Mosesohn committed
apiServerCertSANs:
{% for san in  apiserver_sans.split(' ') | unique %}
  - {{ san }}
{% endfor %}
certificatesDir: {{ kube_config_dir }}/ssl
unifiedControlPlaneImage: "{{ hyperkube_image_repo }}:{{ hyperkube_image_tag }}"
{% if kube_override_hostname|default('') %}
nodeName: {{ kube_override_hostname }}
woopstar's avatar
woopstar committed
apiServerExtraVolumes:
{% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere"] %}
  - name: cloud-config
    hostPath: {{ kube_config_dir }}
    mountPath: {{ kube_config_dir }}
{% endif %}
{% if kube_basic_auth|default(true) %}
- name: basic-auth-config
  hostPath: {{ kube_users_dir }}
  mountPath: {{ kube_users_dir }}
{% endif %}
{% if kube_token_auth|default(true) %}
- name: token-auth-config
  hostPath: {{ kube_token_dir }}
  mountPath: {{ kube_token_dir }}
{% endif %}
controllerManagerExtraVolumes:
{% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere"] %}
  - name: cloud-config
    hostPath: {{ kube_config_dir }}
    mountPath: {{ kube_config_dir }}
{% endif %}
schedulerExtraVolumes:
{% if (cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere"]) or volume_cross_zone_attachment %}
  - name: cloud-config
    hostPath: {{ kube_config_dir }}
    mountPath: {{ kube_config_dir }}
{% endif %}