Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Sergey Bondarev 2018-03-16 14:09:54 +03:00
commit 3fac550090
12 changed files with 50 additions and 9 deletions

View file

@ -111,7 +111,10 @@ kube_apiserver_insecure_port: 8080 # (http)
# Kube-proxy proxyMode configuration. # Kube-proxy proxyMode configuration.
# Can be ipvs, iptables # Can be ipvs, iptables
kube_proxy_mode: iptables kube_proxy_mode: iptables
## Encrypting Secret Data at Rest (experimental)
kube_encrypt_secret_data: false
# DNS configuration. # DNS configuration.
# Kubernetes cluster name, also will be used as DNS domain # Kubernetes cluster name, also will be used as DNS domain

View file

@ -7,4 +7,4 @@ metadata:
labels: labels:
k8s-app: ingress-nginx k8s-app: ingress-nginx
data: data:
{{ ingress_nginx_configmap | to_nice_yaml }} {{ ingress_nginx_configmap | to_nice_yaml | indent(2) }}

View file

@ -7,4 +7,4 @@ metadata:
labels: labels:
k8s-app: ingress-nginx k8s-app: ingress-nginx
data: data:
{{ ingress_nginx_configmap_tcp_services | to_nice_yaml }} {{ ingress_nginx_configmap_tcp_services | to_nice_yaml | indent(2) }}

View file

@ -7,4 +7,4 @@ metadata:
labels: labels:
k8s-app: ingress-nginx k8s-app: ingress-nginx
data: data:
{{ ingress_nginx_configmap_udp_services | to_nice_yaml }} {{ ingress_nginx_configmap_udp_services | to_nice_yaml | indent(2) }}

View file

@ -92,3 +92,8 @@ kube_kubeadm_scheduler_extra_args: {}
## Variable for influencing kube-scheduler behaviour ## Variable for influencing kube-scheduler behaviour
volume_cross_zone_attachment: false volume_cross_zone_attachment: false
## Encrypting Secret Data at Rest
kube_encrypt_secret_data: false
kube_encrypt_token: "{{ lookup('password', inventory_dir + '/credentials/kube_encrypt_token length=32 chars=ascii_letters,digits') }}"
kube_encryption_algorithm: "aescbc" # Must be either: aescbc, secretbox or aesgcm

View file

@ -0,0 +1,10 @@
---
- name: Write secrets for encrypting secret data at rest
template:
src: secrets_encryption.yaml.j2
dest: "{{ kube_config_dir }}/ssl/secrets_encryption.yaml"
owner: root
group: "{{ kube_cert_group }}"
mode: 0640
tags:
- kube-apiserver

View file

@ -12,6 +12,9 @@
- import_tasks: users-file.yml - import_tasks: users-file.yml
when: kube_basic_auth|default(true) when: kube_basic_auth|default(true)
- import_tasks: encrypt-at-rest.yml
when: kube_encrypt_secret_data
- name: Compare host kubectl with hyperkube container - name: Compare host kubectl with hyperkube container
command: "{{ docker_bin_dir }}/docker run --rm -v {{ bin_dir }}:/systembindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /usr/bin/cmp /hyperkube /systembindir/kubectl" command: "{{ docker_bin_dir }}/docker run --rm -v {{ bin_dir }}:/systembindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /usr/bin/cmp /hyperkube /systembindir/kubectl"
register: kubectl_task_compare_result register: kubectl_task_compare_result

View file

@ -37,6 +37,7 @@ apiServerExtraArgs:
admission-control: {{ kube_apiserver_admission_control | join(',') }} admission-control: {{ kube_apiserver_admission_control | join(',') }}
apiserver-count: "{{ kube_apiserver_count }}" apiserver-count: "{{ kube_apiserver_count }}"
service-node-port-range: {{ kube_apiserver_node_port_range }} service-node-port-range: {{ kube_apiserver_node_port_range }}
kubelet-preferred-address-types: "{{ kubelet_preferred_address_types }}"
{% if kube_basic_auth|default(true) %} {% if kube_basic_auth|default(true) %}
basic-auth-file: {{ kube_users_dir }}/known_users.csv basic-auth-file: {{ kube_users_dir }}/known_users.csv
{% endif %} {% endif %}
@ -52,6 +53,9 @@ apiServerExtraArgs:
{% if kube_oidc_groups_claim is defined %} {% if kube_oidc_groups_claim is defined %}
oidc-groups-claim: {{ kube_oidc_groups_claim }} oidc-groups-claim: {{ kube_oidc_groups_claim }}
{% endif %} {% endif %}
{% endif %}
{% if kube_encrypt_secret_data %}
experimental-encryption-provider-config: {{ kube_config_dir }}/ssl/secrets_encryption.yaml
{% endif %} {% endif %}
storage-backend: {{ kube_apiserver_storage_backend }} storage-backend: {{ kube_apiserver_storage_backend }}
{% if kube_api_runtime_config is defined %} {% if kube_api_runtime_config is defined %}
@ -59,7 +63,7 @@ apiServerExtraArgs:
{% endif %} {% endif %}
allow-privileged: "true" allow-privileged: "true"
{% for key in kube_kubeadm_apiserver_extra_args %} {% for key in kube_kubeadm_apiserver_extra_args %}
{{ key }}: {{ kube_kubeadm_apiserver_extra_args[key] }} {{ key }}: "{{ kube_kubeadm_apiserver_extra_args[key] }}"
{% endfor %} {% endfor %}
controllerManagerExtraArgs: controllerManagerExtraArgs:
node-monitor-grace-period: {{ kube_controller_node_monitor_grace_period }} node-monitor-grace-period: {{ kube_controller_node_monitor_grace_period }}
@ -69,12 +73,12 @@ controllerManagerExtraArgs:
feature-gates: {{ kube_feature_gates|join(',') }} feature-gates: {{ kube_feature_gates|join(',') }}
{% endif %} {% endif %}
{% for key in kube_kubeadm_controller_extra_args %} {% for key in kube_kubeadm_controller_extra_args %}
{{ key }}: {{ kube_kubeadm_controller_extra_args[key] }} {{ key }}: "{{ kube_kubeadm_controller_extra_args[key] }}"
{% endfor %} {% endfor %}
{% if kube_kubeadm_scheduler_extra_args|length > 0 %} {% if kube_kubeadm_scheduler_extra_args|length > 0 %}
schedulerExtraArgs: schedulerExtraArgs:
{% for key in kube_kubeadm_scheduler_extra_args %} {% for key in kube_kubeadm_scheduler_extra_args %}
{{ key }}: {{ kube_kubeadm_scheduler_extra_args[key] }} {{ key }}: "{{ kube_kubeadm_scheduler_extra_args[key] }}"
{% endfor %} {% endfor %}
{% endif %} {% endif %}
apiServerCertSANs: apiServerCertSANs:

View file

@ -103,6 +103,9 @@ spec:
{% if authorization_modes %} {% if authorization_modes %}
- --authorization-mode={{ authorization_modes|join(',') }} - --authorization-mode={{ authorization_modes|join(',') }}
{% endif %} {% endif %}
{% if kube_encrypt_secret_data %}
- --experimental-encryption-provider-config={{ kube_config_dir }}/ssl/secrets_encryption.yaml
{% endif %}
{% if kube_feature_gates %} {% if kube_feature_gates %}
- --feature-gates={{ kube_feature_gates|join(',') }} - --feature-gates={{ kube_feature_gates|join(',') }}
{% endif %} {% endif %}

View file

@ -0,0 +1,11 @@
kind: EncryptionConfig
apiVersion: v1
resources:
- resources:
- secrets
providers:
- {{ kube_encryption_algorithm }}:
keys:
- name: key
secret: {{ kube_encrypt_token | b64encode }}
- identity: {}

View file

@ -1,4 +1,4 @@
### Upstream source https://github.com/kubernetes/release/blob/master/debian/xenial/kubeadm/channel/stable/etc/systemd/system/kubelet.service.d/10-kubeadm.conf ### Upstream source https://github.com/kubernetes/release/blob/master/debian/xenial/kubeadm/channel/stable/etc/systemd/system/kubelet.service.d/
### All upstream values should be present in this file ### All upstream values should be present in this file
# logging to stderr means we get it in the systemd journal # logging to stderr means we get it in the systemd journal
@ -23,13 +23,14 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}"
{% if kubelet_authentication_token_webhook %} {% if kubelet_authentication_token_webhook %}
--authentication-token-webhook \ --authentication-token-webhook \
{% endif %} {% endif %}
{% if kubelet_authorization_mode_webhook %}
--authorization-mode=Webhook \ --authorization-mode=Webhook \
{% endif %}
--client-ca-file={{ kube_cert_dir }}/ca.crt \ --client-ca-file={{ kube_cert_dir }}/ca.crt \
--pod-manifest-path={{ kube_manifest_dir }} \ --pod-manifest-path={{ kube_manifest_dir }} \
--cadvisor-port={{ kube_cadvisor_port }} \ --cadvisor-port={{ kube_cadvisor_port }} \
{# end kubeadm specific settings #} {# end kubeadm specific settings #}
--pod-infra-container-image={{ pod_infra_image_repo }}:{{ pod_infra_image_tag }} \ --pod-infra-container-image={{ pod_infra_image_repo }}:{{ pod_infra_image_tag }} \
--kube-reserved cpu={{ kube_cpu_reserved }},memory={{ kube_memory_reserved|regex_replace('Mi', 'M') }} \
--node-status-update-frequency={{ kubelet_status_update_frequency }} \ --node-status-update-frequency={{ kubelet_status_update_frequency }} \
--cgroup-driver={{ kubelet_cgroup_driver|default(kubelet_cgroup_driver_detected) }} \ --cgroup-driver={{ kubelet_cgroup_driver|default(kubelet_cgroup_driver_detected) }} \
--docker-disable-shared-pid={{ kubelet_disable_shared_pid }} \ --docker-disable-shared-pid={{ kubelet_disable_shared_pid }} \

View file

@ -15,3 +15,4 @@ etcd_deployment_type: host
deploy_netchecker: true deploy_netchecker: true
kubedns_min_replicas: 1 kubedns_min_replicas: 1
cloud_provider: gce cloud_provider: gce
kube_encrypt_secret_data: true