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.

107 lines
3.8 KiB

  1. apiVersion: v1
  2. kind: Pod
  3. metadata:
  4. name: kube-apiserver
  5. namespace: {{system_namespace}}
  6. labels:
  7. k8s-app: kube-apiserver
  8. kargo: v2
  9. spec:
  10. hostNetwork: true
  11. containers:
  12. - name: kube-apiserver
  13. image: {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }}
  14. imagePullPolicy: {{ k8s_image_pull_policy }}
  15. resources:
  16. limits:
  17. cpu: {{ kube_apiserver_cpu_limit }}
  18. memory: {{ kube_apiserver_memory_limit }}
  19. requests:
  20. cpu: {{ kube_apiserver_cpu_requests }}
  21. memory: {{ kube_apiserver_memory_requests }}
  22. command:
  23. - /hyperkube
  24. - apiserver
  25. - --advertise-address={{ ip | default(ansible_default_ipv4.address) }}
  26. - --etcd-servers={{ etcd_access_endpoint }}
  27. - --etcd-quorum-read=true
  28. - --etcd-cafile={{ etcd_cert_dir }}/ca.pem
  29. - --etcd-certfile={{ etcd_cert_dir }}/node-{{ inventory_hostname }}.pem
  30. - --etcd-keyfile={{ etcd_cert_dir }}/node-{{ inventory_hostname }}-key.pem
  31. - --insecure-bind-address={{ kube_apiserver_insecure_bind_address }}
  32. - --apiserver-count={{ kube_apiserver_count }}
  33. - --admission-control=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,ResourceQuota
  34. - --service-cluster-ip-range={{ kube_service_addresses }}
  35. - --service-node-port-range={{ kube_apiserver_node_port_range }}
  36. - --client-ca-file={{ kube_cert_dir }}/ca.pem
  37. {% if kube_basic_auth|default(true) %}
  38. - --basic-auth-file={{ kube_users_dir }}/known_users.csv
  39. {% endif %}
  40. - --tls-cert-file={{ kube_cert_dir }}/apiserver.pem
  41. - --tls-private-key-file={{ kube_cert_dir }}/apiserver-key.pem
  42. {% if kube_token_auth|default(true) %}
  43. - --token-auth-file={{ kube_token_dir }}/known_tokens.csv
  44. {% endif %}
  45. - --service-account-key-file={{ kube_cert_dir }}/apiserver-key.pem
  46. {% if kube_oidc_auth|default(false) and kube_oidc_url is defined and kube_oidc_client_id is defined %}
  47. - --oidc-issuer-url={{ kube_oidc_url }}
  48. - --oidc-client-id={{ kube_oidc_client_id }}
  49. {% if kube_oidc_ca_file is defined %}
  50. - --oidc-ca-file={{ kube_oidc_ca_file }}
  51. {% endif %}
  52. {% if kube_oidc_username_claim is defined %}
  53. - --oidc-username-claim={{ kube_oidc_username_claim }}
  54. {% endif %}
  55. {% if kube_oidc_groups_claim is defined %}
  56. - --oidc-groups-claim={{ kube_oidc_groups_claim }}
  57. {% endif %}
  58. {% endif %}
  59. - --secure-port={{ kube_apiserver_port }}
  60. - --insecure-port={{ kube_apiserver_insecure_port }}
  61. - --storage-backend={{ kube_apiserver_storage_backend }}
  62. {% if kube_api_runtime_config is defined %}
  63. {% for conf in kube_api_runtime_config %}
  64. - --runtime-config={{ conf }}
  65. {% endfor %}
  66. {% endif %}
  67. {% if enable_network_policy %}
  68. - --runtime-config=extensions/v1beta1/networkpolicies=true
  69. {% endif %}
  70. - --v={{ kube_log_level }}
  71. - --allow-privileged=true
  72. {% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere"] %}
  73. - --cloud-provider={{ cloud_provider }}
  74. - --cloud-config={{ kube_config_dir }}/cloud_config
  75. {% elif cloud_provider is defined and cloud_provider == "aws" %}
  76. - --cloud-provider={{ cloud_provider }}
  77. {% endif %}
  78. {% if kube_api_anonymous_auth is defined and kube_version | version_compare('v1.5', '>=') %}
  79. - --anonymous-auth={{ kube_api_anonymous_auth }}
  80. {% endif %}
  81. livenessProbe:
  82. httpGet:
  83. host: 127.0.0.1
  84. path: /healthz
  85. port: 8080
  86. initialDelaySeconds: 30
  87. timeoutSeconds: 10
  88. volumeMounts:
  89. - mountPath: {{ kube_config_dir }}
  90. name: kubernetes-config
  91. readOnly: true
  92. - mountPath: /etc/ssl/certs
  93. name: ssl-certs-host
  94. readOnly: true
  95. - mountPath: {{ etcd_cert_dir }}
  96. name: etcd-certs
  97. readOnly: true
  98. volumes:
  99. - hostPath:
  100. path: {{ kube_config_dir }}
  101. name: kubernetes-config
  102. - hostPath:
  103. path: /etc/ssl/certs/
  104. name: ssl-certs-host
  105. - hostPath:
  106. path: {{ etcd_cert_dir }}
  107. name: etcd-certs