Fix graceful shutdown of brokers, more settings, version bump (#5082)

Add 'exec' in broker start CMD so jvm runs as PSID 1
Add terminationGracePeriodSeconds setting
Add java heap setting
Add podManagementPolicy setting
Bump cp-kafka to 4.0.1-1
Fixes to default zk storage and resource value overrides
This commit is contained in:
Thomas David Dickinson
2018-04-17 07:27:59 -07:00
committed by k8s-ci-robot
parent 4a70cab3a1
commit ab0431b40c
4 changed files with 31 additions and 10 deletions
+2 -2
View File
@@ -2,8 +2,8 @@ apiVersion: v1
description: Apache Kafka is publish-subscribe messaging rethought as a distributed
commit log.
name: kafka
version: 0.5.1
appVersion: 4.0.0
version: 0.5.2
appVersion: 4.0.1
keywords:
- kafka
- zookeeper
+6 -3
View File
@@ -61,6 +61,7 @@ following configurable parameters:
| `replicas` | Kafka Brokers | `3` |
| `component` | Kafka k8s selector key | `kafka` |
| `resources` | Kafka resource requests and limits | `{}` |
| `kafkaHeapOptions` | Kafka broker JVM heap options | `-Xmx1G-Xms1G` |
| `logSubPath` | Subpath under `persistence.mountPath` where kafka logs will be placed. | `logs` |
| `schedulerName` | Name of Kubernetes scheduler (other than the default) | `nil` |
| `affinity` | Pod scheduling preferences | `{}` |
@@ -71,13 +72,15 @@ following configurable parameters:
| `external.domain` | Domain in which to advertise Kafka external listeners. | `cluster.local` |
| `external.init` | External init container settings. | (see `values.yaml`) |
| `configurationOverrides` | `Kafka ` [configuration setting][brokerconfigs] overrides in the dictionary format | `{ offsets.topic.replication.factor: 3 }` |
| `additionalPorts` | Additional ports to expose on brokers. Useful when the image exposes metrics (like prometheus, etc.) through a javaagent instead of a sidecar | `{}` |
| `additionalPorts` | Additional ports to expose on brokers. Useful when the image exposes metrics (like prometheus, etc.) through a javaagent instead of a sidecar | `{}` |
| `readinessProbe.initialDelaySeconds` | Number of seconds before probe is initiated. | `30` |
| `readinessProbe.periodSeconds` | How often (in seconds) to perform the probe. | `10` |
| `readinessProbe.timeoutSeconds` | Number of seconds after which the probe times out. | `5` |
| `readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` |
| `readinessProbe.failureThreshold` | After the probe fails this many times, pod will be marked Unready. | `3` |
| `terminationGracePeriodSeconds` | Wait up to this many seconds for a broker to shut down gracefully, after which it is killed | `60` |
| `updateStrategy` | StatefulSet update strategy to use. | `{ type: "OnDelete" }` |
| `podManagementPolicy` | Start and stop pods in Parallel or OrderedReady (one-by-one.) Can not change after first release. | `OrderedReady` |
| `persistence.enabled` | Use a PVC to persist data | `true` |
| `persistence.size` | Size of data volume | `1Gi` |
| `persistence.mountPath` | Mount path of data volume | `/opt/kafka/data` |
@@ -136,9 +139,9 @@ Where `my-release` is the name of your helm release.
## Extensions
Kafka has a rich ecosystem, with lots of tools. This sections is intended to compile all of those tools for which a corresponding Helm chart has already been created.
Kafka has a rich ecosystem, with lots of tools. This sections is intended to compile all of those tools for which a corresponding Helm chart has already been created.
- [Schema-registry](https://github.com/kubernetes/charts/tree/master/incubator/schema-registry) - A confluent project that provides a serving layer for your metadata. It provides a RESTful interface for storing and retrieving Avro schemas.
- [Schema-registry](https://github.com/kubernetes/charts/tree/master/incubator/schema-registry) - A confluent project that provides a serving layer for your metadata. It provides a RESTful interface for storing and retrieving Avro schemas.
### Connecting to Kafka from outside Kubernetes
+5 -1
View File
@@ -10,6 +10,7 @@ metadata:
heritage: {{ .Release.Service | quote }}
spec:
serviceName: {{ template "kafka.fullname" . }}-headless
podManagementPolicy: {{ .Values.podManagementPolicy }}
updateStrategy:
{{ toYaml .Values.updateStrategy | indent 4 }}
replicas: {{ default 3 .Values.replicas }}
@@ -133,6 +134,8 @@ spec:
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: KAFKA_HEAP_OPTS
value: {{ .Values.heapOptions }}
{{- if not (hasKey .Values.configurationOverrides "zookeeper.connect") }}
- name: KAFKA_ZOOKEEPER_CONNECT
value: {{ include "zookeeper.url" . | quote }}
@@ -159,7 +162,7 @@ spec:
- |
export KAFKA_BROKER_ID=${HOSTNAME##*-} && \
export KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://${POD_IP}:9092{{ if kindIs "string" $advertisedListenersOverride }}{{ printf ",%s" $advertisedListenersOverride }}{{ end }} && \
/etc/confluent/docker/run
exec /etc/confluent/docker/run
volumeMounts:
- name: datadir
mountPath: {{ .Values.persistence.mountPath | quote }}
@@ -173,6 +176,7 @@ spec:
configMap:
name: {{ template "kafka.fullname" . }}-metrics
{{- end }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
{{- if .Values.persistence.enabled }}
volumeClaimTemplates:
- metadata:
+18 -4
View File
@@ -9,7 +9,7 @@ replicas: 3
image: "confluentinc/cp-kafka"
## The kafka image tag
imageTag: "4.0.0"
imageTag: "4.0.1-1"
## Specify a imagePullPolicy
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
@@ -24,12 +24,17 @@ resources: {}
# requests:
# cpu: 100m
# memory: 1024Mi
kafkaHeapOptions: "-Xmx1G -Xms1G"
## The StatefulSet Update Strategy which Kafka will use when changes are applied.
## ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies
updateStrategy:
type: "OnDelete"
## Start and stop pods in Parallel or OrderedReady (one-by-one.) Note - Can not change after first release.
## ref: https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#pod-management-policy
podManagementPolicy: OrderedReady
## The name of the storage class which the cluster should use.
# storageClass: default
@@ -61,6 +66,11 @@ readinessProbe:
successThreshold: 1
failureThreshold: 3
## Period to wait for broker graceful shutdown (sigterm) before pod is killed (sigkill)
## ref: https://kubernetes-v1-4.github.io/docs/user-guide/production-pods/#lifecycle-hooks-and-termination-notice
## ref: https://kafka.apache.org/10/documentation.html#brokerconfigs controlled.shutdown.*
terminationGracePeriodSeconds: 60
# Tolerations for nodes that have taints on them.
# Useful if you want to dedicate nodes to just run kafka
# https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
@@ -91,6 +101,8 @@ configurationOverrides:
"offsets.topic.replication.factor": 3
# "auto.leader.rebalance.enable": true
# "auto.create.topics.enable": true
# "controlled.shutdown.enable": true
# "controlled.shutdown.max.retries": 100
## Options required for external access via NodePort
## ref:
@@ -188,13 +200,15 @@ zookeeper:
## Configure Zookeeper resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
resources: {}
resources: ~
## The JVM heap size to allocate to Zookeeper
heap: "1G"
## The amount of PV storage allocated to each Zookeeper pod in the statefulset
storage: "2Gi"
persistence:
enabled: false
## The amount of PV storage allocated to each Zookeeper pod in the statefulset
# storage: "2Gi"
## Specify a Zookeeper imagePullPolicy
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images