mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-03-03 09:49:00 -03:30
add audit webhook support (#6317)
* add audit webhook support * use generic name auditsink
This commit is contained in:
committed by
GitHub
parent
1a1fe99669
commit
a7ec0ed587
@@ -76,6 +76,16 @@ audit_policy_name: audit-policy
|
|||||||
audit_policy_hostpath: "{{ audit_policy_file | dirname }}"
|
audit_policy_hostpath: "{{ audit_policy_file | dirname }}"
|
||||||
audit_policy_mountpath: "{{ audit_policy_hostpath }}"
|
audit_policy_mountpath: "{{ audit_policy_hostpath }}"
|
||||||
|
|
||||||
|
# audit webhook support
|
||||||
|
kubernetes_audit_webhook: false
|
||||||
|
|
||||||
|
# path to audit webhook config file
|
||||||
|
audit_webhook_config_file: "{{ kube_config_dir }}/audit-policy/apiserver-audit-webhook-config.yaml"
|
||||||
|
audit_webhook_server_url: "https://audit.app"
|
||||||
|
audit_webhook_mode: batch
|
||||||
|
audit_webhook_batch_max_size: 100
|
||||||
|
audit_webhook_batch_max_wait: 1s
|
||||||
|
|
||||||
# Limits for kube components
|
# Limits for kube components
|
||||||
kube_controller_memory_limit: 512M
|
kube_controller_memory_limit: 512M
|
||||||
kube_controller_cpu_limit: 250m
|
kube_controller_cpu_limit: 250m
|
||||||
|
|||||||
@@ -80,13 +80,19 @@
|
|||||||
file:
|
file:
|
||||||
path: "{{ audit_policy_file | dirname }}"
|
path: "{{ audit_policy_file | dirname }}"
|
||||||
state: directory
|
state: directory
|
||||||
when: kubernetes_audit|default(false)
|
when: kubernetes_audit|default(false) or kubernetes_audit_webhook|default(false)
|
||||||
|
|
||||||
- name: Write api audit policy yaml
|
- name: Write api audit policy yaml
|
||||||
template:
|
template:
|
||||||
src: apiserver-audit-policy.yaml.j2
|
src: apiserver-audit-policy.yaml.j2
|
||||||
dest: "{{ audit_policy_file }}"
|
dest: "{{ audit_policy_file }}"
|
||||||
when: kubernetes_audit|default(false)
|
when: kubernetes_audit|default(false) or kubernetes_audit_webhook|default(false)
|
||||||
|
|
||||||
|
- name: Write api audit webhook config yaml
|
||||||
|
template:
|
||||||
|
src: apiserver-audit-webhook-config.yaml.j2
|
||||||
|
dest: "{{ audit_webhook_config_file }}"
|
||||||
|
when: kubernetes_audit_webhook|default(false)
|
||||||
|
|
||||||
# Nginx LB(default), If kubeadm_config_api_fqdn is defined, use other LB by kubeadm controlPlaneEndpoint.
|
# Nginx LB(default), If kubeadm_config_api_fqdn is defined, use other LB by kubeadm controlPlaneEndpoint.
|
||||||
- name: set kubeadm_config_api_fqdn define
|
- name: set kubeadm_config_api_fqdn define
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Config
|
||||||
|
clusters:
|
||||||
|
- cluster:
|
||||||
|
server: {{ audit_webhook_server_url }}
|
||||||
|
name: auditsink
|
||||||
|
contexts:
|
||||||
|
- context:
|
||||||
|
cluster: auditsink
|
||||||
|
user: ""
|
||||||
|
name: default-context
|
||||||
|
current-context: default-context
|
||||||
|
preferences: {}
|
||||||
|
users: []
|
||||||
@@ -169,6 +169,13 @@ apiServer:
|
|||||||
audit-log-maxsize: "{{ audit_log_maxsize }}"
|
audit-log-maxsize: "{{ audit_log_maxsize }}"
|
||||||
audit-policy-file: {{ audit_policy_file }}
|
audit-policy-file: {{ audit_policy_file }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if kubernetes_audit_webhook %}
|
||||||
|
audit-webhook-config-file: {{ audit_webhook_config_file }}
|
||||||
|
audit-policy-file: {{ audit_policy_file }}
|
||||||
|
audit-webhook-mode: {{ audit_webhook_mode }}
|
||||||
|
audit-webhook-batch-max-size: "{{ audit_webhook_batch_max_size }}"
|
||||||
|
audit-webhook-batch-max-wait: "{{ audit_webhook_batch_max_wait }}"
|
||||||
|
{% endif %}
|
||||||
{% 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 %}
|
||||||
@@ -211,7 +218,7 @@ apiServer:
|
|||||||
hostPath: {{ kube_config_dir }}/webhook-token-auth-config.yaml
|
hostPath: {{ kube_config_dir }}/webhook-token-auth-config.yaml
|
||||||
mountPath: {{ kube_config_dir }}/webhook-token-auth-config.yaml
|
mountPath: {{ kube_config_dir }}/webhook-token-auth-config.yaml
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if kubernetes_audit %}
|
{% if kubernetes_audit or kubernetes_audit_webhook %}
|
||||||
- name: {{ audit_policy_name }}
|
- name: {{ audit_policy_name }}
|
||||||
hostPath: {{ audit_policy_hostpath }}
|
hostPath: {{ audit_policy_hostpath }}
|
||||||
mountPath: {{ audit_policy_mountpath }}
|
mountPath: {{ audit_policy_mountpath }}
|
||||||
|
|||||||
Reference in New Issue
Block a user