Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

k8s control plane hardening #4404

Draft
wants to merge 1 commit into
base: development/128.0
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion salt/metalk8s/kubernetes/apiserver/installed.sls
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ include:
name=pod_name, state="ready", ignore_not_found=True
) %}

Ensure audit log path exist:
file.directory:
- name: /var/log/apiserver/
- user: root
- group: root
- mode: '0755'

Create kube-apiserver Pod manifest:
metalk8s.static_pod_managed:
- name: /etc/kubernetes/manifests/kube-apiserver.yaml
Expand Down Expand Up @@ -85,19 +92,28 @@ Create kube-apiserver Pod manifest:
- kube-apiserver
- --advertise-address={{ host }}
- --allow-privileged=true
- --anonymous-auth=false
- --audit-log-maxage=30
- --audit-log-maxbackup=10
- --audit-log-maxsize=100
- --audit-log-path=/var/log/apiserver/audit.log
- --authorization-mode=Node,RBAC
- --client-ca-file=/etc/kubernetes/pki/ca.crt
- --enable-admission-plugins=NodeRestriction
- --disable-admission-plugins=DenyServiceExternalIPs
- --enable-admission-plugins=NodeRestriction,AlwaysPullImages
- --enable-bootstrap-token-auth=true
- --etcd-cafile=/etc/kubernetes/pki/etcd/ca.crt
- --etcd-certfile={{ certificates.client.files['apiserver-etcd'].path }}
- --etcd-keyfile=/etc/kubernetes/pki/apiserver-etcd-client.key
- --etcd-servers={{ etcd_servers | join(",") }}
- --kubelet-certificate-authority=/etc/kubernetes/pki/ca.crt
- --kubelet-client-certificate={{ certificates.client.files['apiserver-kubelet'].path }}
- --kubelet-client-key=/etc/kubernetes/pki/apiserver-kubelet-client.key
- --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname
- --profiling=false
- --proxy-client-cert-file={{ certificates.client.files['front-proxy'].path }}
- --proxy-client-key-file=/etc/kubernetes/pki/front-proxy-client.key
- --request-timeout=300s
- --requestheader-allowed-names=front-proxy-client
- --requestheader-client-ca-file=/etc/kubernetes/pki/front-proxy-ca.crt
- --requestheader-extra-headers-prefix=X-Remote-Extra-
Expand All @@ -106,9 +122,11 @@ Create kube-apiserver Pod manifest:
- --secure-port=6443
- --service-account-issuer=https://kubernetes.default.svc.{{ coredns.cluster_domain }}
- --service-account-key-file=/etc/kubernetes/pki/sa.pub
- --service-account-lookup=true
- --service-account-signing-key-file=/etc/kubernetes/pki/sa.key
- --service-cluster-ip-range={{ networks.service }}
- --tls-cert-file={{ certificates.server.files.apiserver.path }}
- --tls-cipher-suites=TLS_AES_128_GCM_SHA256,TLS_AES_256_GCM_SHA384,TLS_CHACHA20_POLY1305_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256,TLS_RSA_WITH_3DES_EDE_CBC_SHA,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_128_GCM_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_GCM_SHA384.
- --tls-private-key-file=/etc/kubernetes/pki/apiserver.key
# }
- --bind-address={{ host }}
Expand Down
Loading