Skip to content

Commit

Permalink
Merge pull request #2839 from zalando-incubator/bound-service-account…
Browse files Browse the repository at this point in the history
…-tokens

Enable rotation of service account tokens
  • Loading branch information
szuecs authored Jan 17, 2020
2 parents 4a2d806 + 0940b38 commit 1717c00
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 8 deletions.
2 changes: 2 additions & 0 deletions cluster/config-defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ apiserver_proxy: "true"
# when set to true, service account tokens can be used from outside the cluster
# requires apiserver_proxy to be set to "true"
allow_external_service_accounts: "false"
# issue service account tokens with expiration time.
rotate_service_account_tokens: "false"

# use kube-aws-iam-controller for kube-system components
kube_aws_iam_controller_kube_system_enable: "true"
Expand Down
2 changes: 2 additions & 0 deletions cluster/manifests/dashboard/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ spec:
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 1000
securityContext:
fsGroup: 1000
2 changes: 2 additions & 0 deletions cluster/manifests/external-dns/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ spec:
runAsUser: 65534
capabilities:
drop: ["ALL"]
securityContext:
fsGroup: 65534
{{ if eq .ConfigItems.kube_aws_iam_controller_kube_system_enable "true"}}
volumes:
- name: aws-iam-credentials
Expand Down
2 changes: 2 additions & 0 deletions cluster/manifests/heapster/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ spec:
value: "1"
priorityClassName: system-cluster-critical
serviceAccountName: heapster
securityContext:
fsGroup: 65534
containers:
- image: registry.opensource.zalan.do/teapot/heapster:v1.5.4
name: heapster
Expand Down
1 change: 1 addition & 0 deletions cluster/manifests/kube-proxy/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ data:
enableProfiling: false
featureGates:
TaintBasedEvictions: true
BoundServiceAccountTokenVolume: {{ .Cluster.ConfigItems.rotate_service_account_tokens }}
healthzBindAddress: 0.0.0.0:10256
hostnameOverride: ""
iptables:
Expand Down
2 changes: 2 additions & 0 deletions cluster/manifests/kube-state-metrics/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ spec:
runAsUser: 65534
capabilities:
drop: ["ALL"]
securityContext:
fsGroup: 65534
1 change: 1 addition & 0 deletions cluster/manifests/psp/pod_security_policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ spec:
- persistentVolumeClaim
- downwardAPI
- configMap
- projected
2 changes: 2 additions & 0 deletions cluster/manifests/skipper/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ spec:
name: skipper-ingress
key: lightstep-token
{{ end }}
securityContext:
fsGroup: 1000
{{ if eq .ConfigItems.enable_apimonitoring "true"}}
volumes:
- name: filters
Expand Down
14 changes: 8 additions & 6 deletions cluster/node-pools/master-default/userdata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@ write_files:
{{- if not (index .Cluster.ConfigItems "enable_cfs_quota") }}
cpuCFSQuota: false
{{- end }}
{{- if ne .NodePool.ConfigItems.pod_max_pids "-1" }}
featureGates:
SupportPodPidsLimit: true
BoundServiceAccountTokenVolume: {{ .Cluster.ConfigItems.rotate_service_account_tokens }}
podPidsLimit: {{ .NodePool.ConfigItems.pod_max_pids }}
{{- end }}
maxPods: {{ nodeCIDRMaxPods (parseInt64 .Cluster.ConfigItems.node_cidr_mask_size) 8 }}
healthzPort: 10248
healthzBindAddress: "0.0.0.0"
Expand Down Expand Up @@ -120,8 +118,12 @@ write_files:
- --authorization-mode=Webhook,RBAC
- --authorization-webhook-config-file=/etc/kubernetes/config/authz.yaml
- --admission-control-config-file=/etc/kubernetes/config/image-policy-webhook.yaml
- --feature-gates=TaintNodesByCondition={{.Cluster.ConfigItems.experimental_schedule_daemonset_pods}},ScheduleDaemonSetPods={{.Cluster.ConfigItems.experimental_schedule_daemonset_pods}},TTLAfterFinished=true,CustomResourceWebhookConversion={{.Cluster.ConfigItems.custom_resource_webhook_conversion}},CustomResourcePublishOpenAPI={{.Cluster.ConfigItems.custom_resource_publish_openapi}}
- --feature-gates=TaintNodesByCondition={{.Cluster.ConfigItems.experimental_schedule_daemonset_pods}},ScheduleDaemonSetPods={{.Cluster.ConfigItems.experimental_schedule_daemonset_pods}},TTLAfterFinished=true,CustomResourceWebhookConversion={{.Cluster.ConfigItems.custom_resource_webhook_conversion}},CustomResourcePublishOpenAPI={{.Cluster.ConfigItems.custom_resource_publish_openapi}},BoundServiceAccountTokenVolume={{ .Cluster.ConfigItems.rotate_service_account_tokens }}
- --anonymous-auth=false
{{- if eq .Cluster.ConfigItems.rotate_service_account_tokens "true" }}
- --service-account-signing-key-file=/etc/kubernetes/ssl/service-account-private-key.pem
- --service-account-issuer=kubernetes/serviceaccount
{{- end }}
{{ if ne .Cluster.ConfigItems.audittrail_url "" }}
- --audit-webhook-config-file=/etc/kubernetes/config/audit.yaml
- --audit-webhook-mode=batch
Expand Down Expand Up @@ -461,7 +463,7 @@ write_files:
- --root-ca-file=/etc/kubernetes/ssl/ca.pem
- --cloud-provider=aws
- --cloud-config=/etc/kubernetes/cloud-config.ini
- --feature-gates=TaintNodesByCondition={{.Cluster.ConfigItems.experimental_schedule_daemonset_pods}},ScheduleDaemonSetPods={{.Cluster.ConfigItems.experimental_schedule_daemonset_pods}},TTLAfterFinished=true
- --feature-gates=TaintNodesByCondition={{.Cluster.ConfigItems.experimental_schedule_daemonset_pods}},ScheduleDaemonSetPods={{.Cluster.ConfigItems.experimental_schedule_daemonset_pods}},TTLAfterFinished=true,BoundServiceAccountTokenVolume={{ .Cluster.ConfigItems.rotate_service_account_tokens }}
- --horizontal-pod-autoscaler-use-rest-clients=true
- --use-service-account-credentials=true
- --configure-cloud-routes=false
Expand Down Expand Up @@ -524,7 +526,7 @@ write_files:
args:
- --master=http://127.0.0.1:8080
- --leader-elect=true
- --feature-gates=TaintBasedEvictions=true,TaintNodesByCondition={{.Cluster.ConfigItems.experimental_schedule_daemonset_pods}},ScheduleDaemonSetPods={{.Cluster.ConfigItems.experimental_schedule_daemonset_pods}}
- --feature-gates=TaintBasedEvictions=true,TaintNodesByCondition={{.Cluster.ConfigItems.experimental_schedule_daemonset_pods}},ScheduleDaemonSetPods={{.Cluster.ConfigItems.experimental_schedule_daemonset_pods}},BoundServiceAccountTokenVolume={{ .Cluster.ConfigItems.rotate_service_account_tokens }}
env:
- name: KUBE_MAX_PD_VOLS
value: "26"
Expand Down
5 changes: 3 additions & 2 deletions cluster/node-pools/worker-default/userdata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@ write_files:
kind: KubeletConfiguration
clusterDomain: cluster.local
cpuCFSQuota: false
{{- if ne .NodePool.ConfigItems.pod_max_pids "-1" }}
featureGates:
SupportPodPidsLimit: true
podPidsLimit: {{ .NodePool.ConfigItems.pod_max_pids }}
{{- if eq .Cluster.ConfigItems.rotate_service_account_tokens "true" }}
BoundServiceAccountTokenVolume: {{ .Cluster.ConfigItems.rotate_service_account_tokens }}
{{- end }}
podPidsLimit: {{ .NodePool.ConfigItems.pod_max_pids }}
cpuManagerPolicy: {{ .NodePool.ConfigItems.cpu_manager_policy }}
maxPods: {{ nodeCIDRMaxPods (parseInt64 .Cluster.ConfigItems.node_cidr_mask_size) 0 }}
healthzPort: 10248
Expand Down

0 comments on commit 1717c00

Please sign in to comment.