You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
2.8 KiB

  1. ###
  2. # kubernetes system config
  3. #
  4. # The following values are used to configure the kube-apiserver
  5. {% if ansible_service_mgr in ["sysvinit","upstart"] %}
  6. # Logging directory
  7. KUBE_LOGGING="--log-dir={{ kube_log_dir }} --logtostderr=true"
  8. {% else %}
  9. # logging to stderr means we get it in the systemd journal
  10. KUBE_LOGGING="--logtostderr=true"
  11. {% endif %}
  12. # Apiserver Log level, 0 is debug
  13. KUBE_LOG_LEVEL="--v={{ kube_log_level | default('2') }}"
  14. # Should this cluster be allowed to run privileged docker containers
  15. KUBE_ALLOW_PRIV="--allow_privileged=true"
  16. # The port on the local server to listen on.
  17. KUBE_API_PORT="--insecure-port={{kube_apiserver_insecure_port}} --secure-port={{ kube_apiserver_port }}"
  18. # Insecure API address (default is localhost)
  19. KUBE_API_INSECURE_BIND="--insecure-bind-address={{ kube_apiserver_insecure_bind_address | default('127.0.0.1') }}"
  20. # Address range to use for services
  21. KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range={{ kube_service_addresses }}"
  22. # Location of the etcd cluster
  23. KUBE_ETCD_SERVERS="--etcd_servers={% for host in groups['etcd'] %}http://{{ hostvars[host]['access_ip'] | default(hostvars[host]['ip'] | default(hostvars[host]['ansible_default_ipv4']['address'])) }}:2379{% if not loop.last %},{% endif %}{% endfor %}"
  24. # Bind address for secure endpoint
  25. KUBE_API_ADDRESS="--bind-address={{ ip | default(ansible_default_ipv4.address) }}"
  26. # default admission control policies
  27. KUBE_ADMISSION_CONTROL="--admission_control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota"
  28. # RUNTIME API CONFIGURATION (e.g. enable extensions)
  29. KUBE_RUNTIME_CONFIG="{% if kube_api_runtime_config is defined %}{% for conf in kube_api_runtime_config %}--runtime-config={{ conf }} {% endfor %}{% endif %}"
  30. # TLS CONFIGURATION
  31. KUBE_TLS_CONFIG="--tls_cert_file={{ kube_cert_dir }}/apiserver.pem --tls_private_key_file={{ kube_cert_dir }}/apiserver-key.pem --client_ca_file={{ kube_cert_dir }}/ca.pem"
  32. # Add you own!
  33. KUBE_API_ARGS="--token_auth_file={{ kube_token_dir }}/known_tokens.csv --basic-auth-file={{ kube_users_dir }}/known_users.csv --service_account_key_file={{ kube_cert_dir }}/apiserver-key.pem --advertise-address={{ ip | default(ansible_default_ipv4.address) }}"
  34. {% if cloud_provider is defined and cloud_provider == "openstack" %}
  35. KUBELET_CLOUDPROVIDER="--cloud-provider={{ cloud_provider }} --cloud-config={{ kube_config_dir }}/cloud_config"
  36. {% else %}
  37. {# TODO: gce and aws don't need the cloud provider to be set? #}
  38. KUBELET_CLOUDPROVIDER=""
  39. {% endif %}
  40. {% if ansible_service_mgr in ["sysvinit","upstart"] %}
  41. DAEMON_ARGS="$KUBE_LOGGING $KUBE_LOG_LEVEL $KUBE_ALLOW_PRIV $KUBE_API_PORT $KUBE_API_INSECURE_BIND \
  42. $KUBE_SERVICE_ADDRESSES $KUBE_ETCD_SERVERS $KUBE_ADMISSION_CONTROL $KUBE_RUNTIME_CONFIG \
  43. $KUBE_TLS_CONFIG $KUBE_API_ARGS $KUBELET_CLOUDPROVIDER"
  44. {% endif %}