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.

117 lines
4.1 KiB

  1. apiVersion: v1
  2. kind: Pod
  3. metadata:
  4. name: kube-controller-manager
  5. namespace: {{system_namespace}}
  6. labels:
  7. k8s-app: kube-controller-manager
  8. annotations:
  9. kubespray.etcd-cert/serial: "{{ etcd_client_cert_serial }}"
  10. kubespray.controller-manager-cert/serial: "{{ controller_manager_cert_serial }}"
  11. spec:
  12. hostNetwork: true
  13. {% if kube_version | version_compare('v1.6', '>=') %}
  14. dnsPolicy: ClusterFirst
  15. {% endif %}
  16. containers:
  17. - name: kube-controller-manager
  18. image: {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }}
  19. imagePullPolicy: {{ k8s_image_pull_policy }}
  20. resources:
  21. limits:
  22. cpu: {{ kube_controller_cpu_limit }}
  23. memory: {{ kube_controller_memory_limit }}
  24. requests:
  25. cpu: {{ kube_controller_cpu_requests }}
  26. memory: {{ kube_controller_memory_requests }}
  27. command:
  28. - /hyperkube
  29. - controller-manager
  30. - --kubeconfig={{ kube_config_dir }}/kube-controller-manager-kubeconfig.yaml
  31. - --leader-elect=true
  32. - --service-account-private-key-file={{ kube_cert_dir }}/apiserver-key.pem
  33. - --root-ca-file={{ kube_cert_dir }}/ca.pem
  34. - --cluster-signing-cert-file={{ kube_cert_dir }}/ca.pem
  35. - --cluster-signing-key-file={{ kube_cert_dir }}/ca-key.pem
  36. - --enable-hostpath-provisioner={{ kube_hostpath_dynamic_provisioner }}
  37. - --node-monitor-grace-period={{ kube_controller_node_monitor_grace_period }}
  38. - --node-monitor-period={{ kube_controller_node_monitor_period }}
  39. - --pod-eviction-timeout={{ kube_controller_pod_eviction_timeout }}
  40. - --profiling=false
  41. - --terminated-pod-gc-threshold=12500
  42. - --v={{ kube_log_level }}
  43. {% if rbac_enabled %}
  44. - --use-service-account-credentials=true
  45. {% endif %}
  46. {% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere"] %}
  47. - --cloud-provider={{cloud_provider}}
  48. - --cloud-config={{ kube_config_dir }}/cloud_config
  49. {% elif cloud_provider is defined and cloud_provider in ["aws", "external"] %}
  50. - --cloud-provider={{cloud_provider}}
  51. {% endif %}
  52. {% if kube_network_plugin is defined and kube_network_plugin == 'cloud' %}
  53. - --configure-cloud-routes=true
  54. {% endif %}
  55. {% if kube_network_plugin is defined and kube_network_plugin in ["cloud", "flannel", "canal"] %}
  56. - --allocate-node-cidrs=true
  57. - --cluster-cidr={{ kube_pods_subnet }}
  58. - --service-cluster-ip-range={{ kube_service_addresses }}
  59. - --node-cidr-mask-size={{ kube_network_node_prefix }}
  60. {% endif %}
  61. {% if kube_feature_gates %}
  62. - --feature-gates={{ kube_feature_gates|join(',') }}
  63. {% endif %}
  64. {% if controller_mgr_custom_flags is string %}
  65. - {{ controller_mgr_custom_flags }}
  66. {% else %}
  67. {% for flag in controller_mgr_custom_flags %}
  68. - {{ flag }}
  69. {% endfor %}
  70. {% endif %}
  71. livenessProbe:
  72. httpGet:
  73. host: 127.0.0.1
  74. path: /healthz
  75. port: 10252
  76. initialDelaySeconds: 30
  77. timeoutSeconds: 10
  78. volumeMounts:
  79. - mountPath: /etc/ssl
  80. name: ssl-certs-host
  81. readOnly: true
  82. {% for dir in ssl_ca_dirs %}
  83. - mountPath: {{ dir }}
  84. name: {{ dir | regex_replace('^/(.*)$', '\\1' ) | regex_replace('/', '-') }}
  85. readOnly: true
  86. {% endfor %}
  87. - mountPath: "{{kube_config_dir}}/ssl"
  88. name: etc-kube-ssl
  89. readOnly: true
  90. - mountPath: "{{ kube_config_dir }}/kube-controller-manager-kubeconfig.yaml"
  91. name: kubeconfig
  92. readOnly: true
  93. {% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere" ] %}
  94. - mountPath: "{{ kube_config_dir }}/cloud_config"
  95. name: cloudconfig
  96. readOnly: true
  97. {% endif %}
  98. volumes:
  99. - name: ssl-certs-host
  100. hostPath:
  101. path: /etc/ssl
  102. {% for dir in ssl_ca_dirs %}
  103. - name: {{ dir | regex_replace('^/(.*)$', '\\1' ) | regex_replace('/', '-') }}
  104. hostPath:
  105. path: {{ dir }}
  106. {% endfor %}
  107. - name: etc-kube-ssl
  108. hostPath:
  109. path: "{{ kube_config_dir }}/ssl"
  110. - name: kubeconfig
  111. hostPath:
  112. path: "{{ kube_config_dir }}/kube-controller-manager-kubeconfig.yaml"
  113. {% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere"] %}
  114. - hostPath:
  115. path: "{{ kube_config_dir }}/cloud_config"
  116. name: cloudconfig
  117. {% endif %}