mirror of
https://github.com/helm/charts.git
synced 2026-08-23 22:37:45 +00:00
[incubator/zookeeper] v1.0: Revamp, add exporters, add chroots job (#4931)
* [incubator/zookeeper] v1.0: Revamp, add exporters, add chroots job * [incubator/zookeeper] Remove unnecessary and from if statement
This commit is contained in:
committed by
k8s-ci-robot
parent
494a6bc4bc
commit
ab579ad0cf
Executable → Regular
+2
-2
@@ -1,7 +1,7 @@
|
||||
name: zookeeper
|
||||
home: https://zookeeper.apache.org/
|
||||
version: 0.6.4
|
||||
appVersion: 3.4.9
|
||||
version: 1.0.0
|
||||
appVersion: 3.4.10
|
||||
description: Centralized service for maintaining configuration information, naming,
|
||||
providing distributed synchronization, and providing group services.
|
||||
icon: https://zookeeper.apache.org/images/zookeeper_small.gif
|
||||
|
||||
+50
-121
@@ -1,5 +1,6 @@
|
||||
# ZooKeeper Helm Chart
|
||||
This helm chart provides an implementation of the ZooKeeper [StatefulSet](http://kubernetes.io/docs/concepts/abstractions/controllers/statefulsets/) found in Kubernetes Contrib [Zookeeper StatefulSet](https://github.com/kubernetes/contrib/tree/master/statefulsets/zookeeper).
|
||||
# incubator/zookeeper
|
||||
|
||||
This helm chart provides an implementation of the ZooKeeper [StatefulSet](http://kubernetes.io/docs/concepts/abstractions/controllers/statefulsets/) found in Kubernetes Contrib [Zookeeper StatefulSet](https://github.com/kubernetes/contrib/tree/master/statefulsets/zookeeper).
|
||||
|
||||
## Prerequisites
|
||||
* Kubernetes 1.6+
|
||||
@@ -14,14 +15,16 @@ This chart will do the following:
|
||||
* Create a [PodDisruptionBudget](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-disruption-budget/) so kubectl drain will respect the Quorum size of the ensemble.
|
||||
* Create a [Headless Service](https://kubernetes.io/docs/concepts/services-networking/service/) to control the domain of the ZooKeeper ensemble.
|
||||
* Create a Service configured to connect to the available ZooKeeper instance on the configured client port.
|
||||
* Optionally, apply a [Pod Anti-Affinity](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#inter-pod-affinity-and-anti-affinity-beta-feature) to spread the ZooKeeper ensemble across nodes.
|
||||
* Optionally apply a [Pod Anti-Affinity](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#inter-pod-affinity-and-anti-affinity-beta-feature) to spread the ZooKeeper ensemble across nodes.
|
||||
* Optionally start JMX Exporter and Zookeeper Exporter containers inside Zookeeper pods.
|
||||
* Optionally create a job which creates Zookeeper chroots (e.g. `/kafka1`).
|
||||
|
||||
## Installing the Chart
|
||||
You can install the chart with the release name `myzk` as below.
|
||||
You can install the chart with the release name `zookeeper` as below.
|
||||
|
||||
```console
|
||||
$ helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator
|
||||
$ helm install --name myzk incubator/zookeeper
|
||||
$ helm install --name zookeeper incubator/zookeeper
|
||||
```
|
||||
|
||||
If you do not specify a name, helm will select a name for you.
|
||||
@@ -31,23 +34,30 @@ You can use `kubectl get` to view all of the installed components.
|
||||
|
||||
```console{%raw}
|
||||
$ kubectl get all -l app=zookeeper
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
po/myzk-zookeeper-0 1/1 Running 0 2m
|
||||
po/myzk-zookeeper-1 1/1 Running 0 1m
|
||||
po/myzk-zookeeper-2 1/1 Running 0 52s
|
||||
NAME: zookeeper
|
||||
LAST DEPLOYED: Wed Apr 11 17:09:48 2018
|
||||
NAMESPACE: default
|
||||
STATUS: DEPLOYED
|
||||
|
||||
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||
svc/myzk-zookeeper 10.3.255.86 <none> 2181/TCP 2m
|
||||
svc/myzk-zookeeper-headless None <none> 2888/TCP,3888/TCP 2m
|
||||
RESOURCES:
|
||||
==> v1beta1/PodDisruptionBudget
|
||||
NAME MIN AVAILABLE MAX UNAVAILABLE ALLOWED DISRUPTIONS AGE
|
||||
zookeeper N/A 1 1 2m
|
||||
|
||||
NAME DESIRED CURRENT AGE
|
||||
statefulsets/myzk-zookeeper 3 3 2m
|
||||
==> v1/Service
|
||||
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||
zookeeper-headless ClusterIP None <none> 2181/TCP,3888/TCP,2888/TCP 2m
|
||||
zookeeper ClusterIP 10.98.179.165 <none> 2181/TCP 2m
|
||||
|
||||
==> v1beta1/StatefulSet
|
||||
NAME DESIRED CURRENT AGE
|
||||
zookeeper 3 3 2m
|
||||
```
|
||||
|
||||
1. `statefulsets/myzk-zookeeper` is the StatefulSet created by the chart.
|
||||
1. `po/myzk-zookeeper-<0|1|2>` are the Pods created by the StatefulSet. Each Pod has a single container running a ZooKeeper server.
|
||||
1. `svc/myzk-zookeeper-headless` is the Headless Service used to control the network domain of the ZooKeeper ensemble.
|
||||
1. `svc/myzk-zookeeper` is a Service that can be used by clients to connect to an available ZooKeeper server.
|
||||
1. `statefulsets/zookeeper` is the StatefulSet created by the chart.
|
||||
1. `po/zookeeper-<0|1|2>` are the Pods created by the StatefulSet. Each Pod has a single container running a ZooKeeper server.
|
||||
1. `svc/zookeeper-headless` is the Headless Service used to control the network domain of the ZooKeeper ensemble.
|
||||
1. `svc/zookeeper` is a Service that can be used by clients to connect to an available ZooKeeper server.
|
||||
|
||||
## Configuration
|
||||
You can specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.
|
||||
@@ -58,86 +68,11 @@ Alternatively, a YAML file that specifies the values for the parameters can be p
|
||||
$ helm install --name my-release -f values.yaml incubator/zookeeper
|
||||
```
|
||||
|
||||
> **Tip**: You can use the default [values.yaml](values.yaml)
|
||||
## Default Values
|
||||
|
||||
### Resources
|
||||
The configuration parameters in this section control the resources requested and utilized by the ZooKeeper ensemble.
|
||||
- You can find all user-configurable settings, their defaults and commentary about them in [values.yaml](values.yaml).
|
||||
|
||||
| Parameter | Description | Default |
|
||||
| --------- | ----------- | ------- |
|
||||
| `servers` | The number of ZooKeeper servers. This should always be (1,3,5, or 7) | `3` |
|
||||
| `updateStrategy` | The ZooKeeper StatefulSet update strategy. | `{ type: "OnDelete" }` |
|
||||
| `minAvailable` | The minimum number of servers that must be available during evictions. This should in the interval `[(servers/2) + 1,(servers - 1)]`. | `servers-1` |
|
||||
| `resources.requests.cpu` | The amount of CPU to request. As ZooKeeper is not very CPU intensive, `2` is a good choice to start with for a production deployment. | `500m` |
|
||||
| `heap` | The amount of JVM heap that the ZooKeeper servers will use. As ZooKeeper stores all of its data in memory, this value should reflect the size of your working set. The JVM -Xms/-Xmx format is used. |`2G` |
|
||||
| `resources.requests.memory` | The amount of memory to request. This value should be at least 2 GiB larger than `heap` to avoid swapping. You may want to use `1.5 * heap` for values larger than 2GiB. The Kubernetes format is used. |`2Gi` |
|
||||
|
||||
### Persistence
|
||||
| Parameter | Description | Default |
|
||||
| --------- | ----------- | ------- |
|
||||
| `persistence.enabled` | Whether to create a PVC. If `false`, an `emptyDir` on the host will be used. | `true` |
|
||||
| `persistence.size` | Size of PVC that gets created. For production deployments this value should likely be much larger. | `5Gi` |
|
||||
| `persistence.storageClass` | Valid options: `nil`, `"-"`, or storage class name. See values.yaml for details. | `nil` |
|
||||
|
||||
### Network
|
||||
These parameters control the network ports on which the ensemble communicates.
|
||||
|
||||
| Parameter | Description | Default |
|
||||
| --------- | ----------- | ------- |
|
||||
| `serverPort` | The port on which the ZooKeeper servers listen for requests from other servers in the ensemble. | `2888` |
|
||||
| `leaderElectionPort` | The port on which the ZooKeeper servers perform leader election. | `3888` |
|
||||
| `clientPort` | The port on which the ZooKeeper servers listen for client requests. | `2181` |
|
||||
| `clientCnxns` | The maximum number of simultaneous client connections that each server in the ensemble will allow. | `60` |
|
||||
|
||||
### Time
|
||||
ZooKeeper uses the Zab protocol to replicate its state machine across the ensemble. The following parameters control the timeouts for the protocol.
|
||||
|
||||
| Parameter | Description | Default |
|
||||
| --------- | ----------- | ------- |
|
||||
| `tickTimeMs` | The number of milliseconds in one ZooKeeper Tick. You might want to increase this value if the network latency is high or unpredictable in your environment. | `2000` |
|
||||
| `initTicks` | The amount of time, in Ticks, that a follower is allowed to connect to and sync with a leader. Increase this value if the amount of data stored on the servers is large. | `10` |
|
||||
| `syncTicks` | The amount of time, in Ticks, that a follower is allowed to lag behind a leader. If the follower is longer than `syncTicks` behind the leader, the follower is dropped. | `5` |
|
||||
|
||||
### Log Retention
|
||||
ZooKeeper writes its WAL (Write Ahead Log) and periodic snapshots to storage media. These parameters control the retention policy for snapshots and WAL segments. If you do not configure the ensemble to automatically periodically purge snapshots and logs, it is important to implement such a mechanism yourself. Otherwise, you will eventually exhaust all available storage media.
|
||||
|
||||
| Parameter | Description | Default |
|
||||
| --------- | ----------- | ------- |
|
||||
| `snapRetain` | The number of snapshots to retain on disk. If `purgeHours` is set to 0 this parameter has no effect. | `3` |
|
||||
| `purgeHours` | The amount of time, in hours, between ZooKeeper snapshot and log purges. Setting this to 0 will disable purges.| `1` |
|
||||
|
||||
### Spreading
|
||||
Spreading allows you specify an anti-affinity between ZooKeeper servers in the ensemble. This will prevent the Pods from being scheduled on the same node.
|
||||
|
||||
| Parameter | Description | Default |
|
||||
| --------- | ----------- | ------- |
|
||||
| `schedulerName` | Name of scheduler to use (other than the default). | `nil` |
|
||||
| `antiAffinity` | If present it must take the values 'hard' or 'soft'. 'hard' will cause the Kubernetes scheduler to not schedule the Pods on the same physical node under any circumstances 'soft' will cause the Kubernetes scheduler to make a best effort to not co-locate the Pods, but, if the only available resources are on the same node, the scheduler will co-locate them. | `hard` |
|
||||
| `tolerations` | An optional list of tolerations for the zookeeper pods. https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ | `[]` |
|
||||
|
||||
### Logging
|
||||
In order to allow for the default installation to work well with the log rolling and retention policy of Kubernetes, all logs are written to stdout. This should also be compatible with logging integrations such as Google Cloud Logging and ELK.
|
||||
|
||||
| Parameter | Description | Default |
|
||||
| --------- | ----------- | ------- |
|
||||
| `logLevel` | The log level of the ZooKeeper applications. One of `ERROR`,`WARN`,`INFO`,`DEBUG`. | `INFO` |
|
||||
|
||||
### Liveness and Readiness
|
||||
The servers in the ensemble have both liveness and readiness checks specified. These parameters can be used to tune the sensitivity of the liveness and readiness checks.
|
||||
|
||||
| Parameter | Description | Default |
|
||||
| --------- | ----------- | ------- |
|
||||
| `probeInitialDelaySeconds` | The initial delay before the liveness and readiness probes will be invoked. | `15` |
|
||||
| `probeTimeoutSeconds` | The amount of time before the probes are considered to be failed due to a timeout. | `5` |
|
||||
|
||||
### ImagePull
|
||||
This parameter controls when the image is pulled from the repository.
|
||||
|
||||
| Parameter | Description | Default |
|
||||
| --------- | ----------- | ------- |
|
||||
| `imagePullPolicy` | The policy for pulling the image from the repository. | `Always` |
|
||||
|
||||
# Deep dive
|
||||
## Deep Dive
|
||||
|
||||
## Image Details
|
||||
The image used for this chart is based on Ubuntu 16.04 LTS. This image is larger than Alpine or BusyBox, but it provides glibc, rather than ulibc or mucl, and a JVM release that is built against it. You can easily convert this chart to run against a smaller image with a JVM that is build against that images libc. However, as far as we know, no Hadoop vendor supports, or has verified, ZooKeeper running on such a JVM.
|
||||
@@ -146,13 +81,13 @@ The image used for this chart is based on Ubuntu 16.04 LTS. This image is larger
|
||||
The Java Virtual Machine used for this chart is the OpenJDK JVM 8u111 JRE (headless).
|
||||
|
||||
## ZooKeeper Details
|
||||
The ZooKeeper version is the latest stable version (3.4.9). The distribution is installed into /opt/zookeeper-3.4.9. This directory is symbolically linked to /opt/zookeeper. Symlinks are created to simulate a rpm installation into /usr.
|
||||
The ZooKeeper version is the latest stable version (3.4.10). The distribution is installed into /opt/zookeeper-3.4.10. This directory is symbolically linked to /opt/zookeeper. Symlinks are created to simulate a rpm installation into /usr.
|
||||
|
||||
## Failover
|
||||
You can test failover by killing the leader. Insert a key:
|
||||
```console
|
||||
$ kubectl exec <RELEASE-NAME>-zookeeper-0 -- /opt/zookeeper/bin/zkCli.sh create /foo bar;
|
||||
$ kubectl exec <RELEASE-NAME>-zookeeper-2 -- /opt/zookeeper/bin/zkCli.sh get /foo;
|
||||
$ kubectl exec zookeeper-0 -- /opt/zookeeper/bin/zkCli.sh create /foo bar;
|
||||
$ kubectl exec zookeeper-2 -- /opt/zookeeper/bin/zkCli.sh get /foo;
|
||||
```
|
||||
|
||||
Watch existing members:
|
||||
@@ -169,30 +104,24 @@ Delete Pods and wait for the StatefulSet controller to bring them back up:
|
||||
```console
|
||||
$ kubectl delete po -l app=zookeeper
|
||||
$ kubectl get po --watch-only
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
myzk-zookeeper-0 0/1 Running 0 35s
|
||||
myzk-zookeeper-0 1/1 Running 0 50s
|
||||
myzk-zookeeper-1 0/1 Pending 0 0s
|
||||
myzk-zookeeper-1 0/1 Pending 0 0s
|
||||
myzk-zookeeper-1 0/1 ContainerCreating 0 0s
|
||||
myzk-zookeeper-1 0/1 Running 0 19s
|
||||
myzk-zookeeper-1 1/1 Running 0 40s
|
||||
myzk-zookeeper-2 0/1 Pending 0 0s
|
||||
myzk-zookeeper-2 0/1 Pending 0 0s
|
||||
myzk-zookeeper-2 0/1 ContainerCreating 0 0s
|
||||
myzk-zookeeper-2 0/1 Running 0 19s
|
||||
myzk-zookeeper-2 1/1 Running 0 41s
|
||||
|
||||
...
|
||||
|
||||
zk-0 Mode: follower
|
||||
zk-1 Mode: leader
|
||||
zk-2 Mode: follower
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
zookeeper-0 0/1 Running 0 35s
|
||||
zookeeper-0 1/1 Running 0 50s
|
||||
zookeeper-1 0/1 Pending 0 0s
|
||||
zookeeper-1 0/1 Pending 0 0s
|
||||
zookeeper-1 0/1 ContainerCreating 0 0s
|
||||
zookeeper-1 0/1 Running 0 19s
|
||||
zookeeper-1 1/1 Running 0 40s
|
||||
zookeeper-2 0/1 Pending 0 0s
|
||||
zookeeper-2 0/1 Pending 0 0s
|
||||
zookeeper-2 0/1 ContainerCreating 0 0s
|
||||
zookeeper-2 0/1 Running 0 19s
|
||||
zookeeper-2 1/1 Running 0 41s
|
||||
```
|
||||
|
||||
Check the previously inserted key:
|
||||
```console
|
||||
$ kubectl exec myzk-zookeeper-1 -- /opt/zookeeper/bin/zkCli.sh get /foo
|
||||
$ kubectl exec zookeeper-1 -- /opt/zookeeper/bin/zkCli.sh get /foo
|
||||
ionid = 0x354887858e80035, negotiated timeout = 30000
|
||||
|
||||
WATCHER::
|
||||
@@ -202,9 +131,9 @@ bar
|
||||
```
|
||||
|
||||
## Scaling
|
||||
ZooKeeper can not be safely scaled in versions prior to 3.5.x. There are manual procedures for scaling an ensemble, but as noted in the [ZooKeeper 3.5.2 documentation](https://zookeeper.apache.org/doc/r3.5.2-alpha/zookeeperReconfig.html) these procedures require a rolling restart, are known to be error prone, and often result in a data loss.
|
||||
ZooKeeper can not be safely scaled in versions prior to 3.5.x. This chart currently uses 3.4.x. There are manual procedures for scaling a 3.4.x ensemble, but as noted in the [ZooKeeper 3.5.2 documentation](https://zookeeper.apache.org/doc/r3.5.2-alpha/zookeeperReconfig.html) these procedures require a rolling restart, are known to be error prone, and often result in a data loss.
|
||||
|
||||
While ZooKeeper 3.5.x does allow for dynamic ensemble reconfiguration (including scaling membership), the current status of the release is still alpha, and it is not recommended for production use.
|
||||
While ZooKeeper 3.5.x does allow for dynamic ensemble reconfiguration (including scaling membership), the current status of the release is still alpha, and 3.5.x is therefore not recommended for production use.
|
||||
|
||||
## Limitations
|
||||
* StatefulSet and PodDisruptionBudget are beta resources.
|
||||
|
||||
@@ -1,26 +1,7 @@
|
||||
Thank you for installing ZooKeeper on your Kubernetes cluster. More information
|
||||
about ZooKeeper can be found at https://zookeeper.apache.org/doc/current/
|
||||
|
||||
1. ZooKeeper will be accessible outside of the Kubernetes cluster only if
|
||||
appropriate annotations and service type were provided. Its purpose is
|
||||
to provide coordination for distributed systems running inside the cluster. As
|
||||
ZooKeeper uses a TCP based protocol with an internal wire format, you will
|
||||
probably want to use an existing client library for communication with the
|
||||
ensemble.
|
||||
Your connection string should look like:
|
||||
{{ template "zookeeper.fullname" . }}-0.{{ template "zookeeper.fullname" . }}-headless:{{ .Values.service.ports.client.port }},{{ template "zookeeper.fullname" . }}-1.{{ template "zookeeper.fullname" . }}-headless:{{ .Values.service.ports.client.port }},...
|
||||
|
||||
2. The officially maintained clients are written in C and Java, and these can be
|
||||
obtained with ZooKeeper release from
|
||||
http://www-us.apache.org/dist/zookeeper/zookeeper-3.4.9/.
|
||||
A list of language specific bindings and higher level libraries is available
|
||||
here https://cwiki.apache.org/confluence/display/ZOOKEEPER/ZKClientBindings.
|
||||
|
||||
3. Most ZooKeeper clients require a connection string when instantiating an
|
||||
instance of the client library, or when first connecting the client to the
|
||||
ensemble. The connection string takes the form
|
||||
<server>:<port>,<server>:<port>,... . If your ensemble has greater than 1
|
||||
server, you should provide multiple servers in the connection string to allow
|
||||
for the client to continue to function in the presence of individual server
|
||||
failures. It is important that you do not use IP addresses and instead use the
|
||||
DNS entries for the domain established by the StatefulSet's HeadlessService.
|
||||
Your connection string should look like {{ template "zookeeper.fullname" . }}-headless-0:{{ .Values.ClientPort }},{{ template "zookeeper.fullname" . }}-headless-1:{{ .Values.ClientPort }},...
|
||||
You can also use the client Service {{ template "zookeeper.fullname" . }}:{{ .Values.ClientPort }} to connect to an available ZooKeeper server.
|
||||
You can also use the client service {{ template "zookeeper.fullname" . }}:{{ .Values.service.ports.client.port }} to connect to an available ZooKeeper server.
|
||||
|
||||
@@ -9,8 +9,24 @@ Expand the name of the chart.
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "zookeeper.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "zookeeper.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
{{- if .Values.exporters.jmx.enabled }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ .Release.Name }}-jmx-exporter
|
||||
labels:
|
||||
app: {{ template "zookeeper.name" . }}
|
||||
chart: {{ template "zookeeper.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
data:
|
||||
config.yml: |-
|
||||
hostPort: 127.0.0.1:{{ .Values.env.JMXPORT }}
|
||||
lowercaseOutputName: {{ .Values.exporters.jmx.config.lowercaseOutputName }}
|
||||
rules:
|
||||
{{ .Values.exporters.jmx.config.rules | toYaml | indent 6 }}
|
||||
ssl: false
|
||||
startDelaySeconds: {{ .Values.exporters.jmx.config.startDelaySeconds }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,62 @@
|
||||
{{- if .Values.jobs.chroots.enabled }}
|
||||
{{- $root := . }}
|
||||
{{- $job := .Values.jobs.chroots }}
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: {{ template "zookeeper.fullname" . }}-chroots
|
||||
annotations:
|
||||
"helm.sh/hook": post-install,post-upgrade
|
||||
"helm.sh/hook-weight": "-5"
|
||||
"helm.sh/hook-delete-policy": hook-succeeded
|
||||
labels:
|
||||
app: {{ template "zookeeper.name" . }}
|
||||
chart: {{ template "zookeeper.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
component: jobs
|
||||
job: chroots
|
||||
spec:
|
||||
activeDeadlineSeconds: {{ $job.activeDeadlineSeconds }}
|
||||
backoffLimit: {{ $job.backoffLimit }}
|
||||
completions: {{ $job.completions }}
|
||||
parallelism: {{ $job.parallelism }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "zookeeper.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
component: jobs
|
||||
job: chroots
|
||||
spec:
|
||||
restartPolicy: {{ $job.restartPolicy }}
|
||||
containers:
|
||||
- name: main
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
command:
|
||||
- /bin/bash
|
||||
- -o
|
||||
- pipefail
|
||||
- -euc
|
||||
{{- $port := .Values.service.ports.client.port }}
|
||||
- >
|
||||
sleep 15;
|
||||
export SERVER={{ template "zookeeper.fullname" $root }}:{{ $port }};
|
||||
{{- range $job.config.create }}
|
||||
echo '==> {{ . }}';
|
||||
echo '====> Create chroot if does not exist.';
|
||||
zkCli.sh -server {{ template "zookeeper.fullname" $root }}:{{ $port }} get {{ . }} 2>&1 >/dev/null | grep 'cZxid'
|
||||
|| zkCli.sh -server {{ template "zookeeper.fullname" $root }}:{{ $port }} create {{ . }} "";
|
||||
echo '====> Confirm chroot exists.';
|
||||
zkCli.sh -server {{ template "zookeeper.fullname" $root }}:{{ $port }} get {{ . }} 2>&1 >/dev/null | grep 'cZxid';
|
||||
echo '====> Chroot exists.';
|
||||
{{- end }}
|
||||
env:
|
||||
{{- range $key, $value := $job.env }}
|
||||
- name: {{ $key | upper | replace "." "_" }}
|
||||
value: {{ $value | quote }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{ toYaml $job.resources | indent 12 }}
|
||||
{{- end -}}
|
||||
@@ -1,21 +1,17 @@
|
||||
{{- if .Release.IsInstall -}}
|
||||
apiVersion: policy/v1beta1
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: {{ template "zookeeper.fullname" . }}
|
||||
labels:
|
||||
app: {{ include "zookeeper.name" . | quote }}
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
release: {{ .Release.Name | quote }}
|
||||
heritage: {{ .Release.Service | quote }}
|
||||
app: {{ template "zookeeper.name" . }}
|
||||
chart: {{ template "zookeeper.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
component: server
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ include "zookeeper.name" . | quote }}
|
||||
release: {{ .Release.Name | quote }}
|
||||
{{- if .Values.minAvailable }}
|
||||
minAvailable: {{ .Values.minAvailable }}
|
||||
{{- else }}
|
||||
minAvailable: {{ sub .Values.servers 1 }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
app: {{ template "zookeeper.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
component: server
|
||||
{{ toYaml .Values.podDisruptionBudget | indent 2 }}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "zookeeper.fullname" . }}
|
||||
{{- if .Values.annotations }}
|
||||
annotations:
|
||||
{{ toYaml .Values.annotations | indent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app: {{ include "zookeeper.name" . | quote }}
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
release: {{ .Release.Name | quote }}
|
||||
heritage: {{ .Release.Service | quote }}
|
||||
spec:
|
||||
ports:
|
||||
- port: {{ .Values.clientPort }}
|
||||
name: client
|
||||
selector:
|
||||
app: {{ include "zookeeper.name" . | quote }}
|
||||
release: {{ .Release.Name | quote }}
|
||||
{{- if .Values.serviceType }}
|
||||
type: {{ .Values.serviceType }}
|
||||
{{- end }}
|
||||
|
||||
@@ -3,17 +3,19 @@ kind: Service
|
||||
metadata:
|
||||
name: {{ template "zookeeper.fullname" . }}-headless
|
||||
labels:
|
||||
app: {{ include "zookeeper.name" . | quote }}
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
release: {{ .Release.Name | quote }}
|
||||
heritage: {{ .Release.Service | quote }}
|
||||
app: {{ template "zookeeper.name" . }}
|
||||
chart: {{ template "zookeeper.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
spec:
|
||||
ports:
|
||||
- port: {{ .Values.serverPort }}
|
||||
name: server
|
||||
- port: {{ .Values.leaderElectionPort }}
|
||||
name: leader-election
|
||||
clusterIP: None
|
||||
ports:
|
||||
{{- range $key, $port := .Values.ports }}
|
||||
- name: {{ $key }}
|
||||
port: {{ $port.containerPort }}
|
||||
targetPort: {{ $port.name }}
|
||||
protocol: {{ $port.protocol }}
|
||||
{{- end }}
|
||||
selector:
|
||||
app: {{ include "zookeeper.name" . | quote }}
|
||||
release: {{ .Release.Name | quote }}
|
||||
app: {{ template "zookeeper.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "zookeeper.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "zookeeper.name" . }}
|
||||
chart: {{ template "zookeeper.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
annotations:
|
||||
{{- with .Values.service.annotations }}
|
||||
{{ toYaml . | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
{{- range $key, $value := .Values.service.ports }}
|
||||
- name: {{ $key }}
|
||||
{{ toYaml $value | indent 6 }}
|
||||
{{- end }}
|
||||
selector:
|
||||
app: {{ template "zookeeper.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
@@ -3,118 +3,181 @@ kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ template "zookeeper.fullname" . }}
|
||||
labels:
|
||||
app: {{ include "zookeeper.name" . | quote }}
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
release: {{ .Release.Name | quote }}
|
||||
heritage: {{ .Release.Service | quote }}
|
||||
app: {{ template "zookeeper.name" . }}
|
||||
chart: {{ template "zookeeper.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
component: server
|
||||
spec:
|
||||
serviceName: {{ template "zookeeper.fullname" . }}-headless
|
||||
replicas: {{ .Values.servers }}
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ template "zookeeper.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
component: server
|
||||
updateStrategy:
|
||||
{{ toYaml .Values.updateStrategy | indent 4 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ include "zookeeper.name" . | quote }}
|
||||
release: {{ .Release.Name | quote }}
|
||||
app: {{ template "zookeeper.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
component: server
|
||||
{{- if .Values.podLabels }}
|
||||
## Custom pod labels
|
||||
{{- range $key, $value := .Values.podLabels }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
{{- if .Values.podAnnotations }}
|
||||
## Custom pod annotations
|
||||
{{- range $key, $value := .Values.podAnnotations }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.tolerations }}
|
||||
tolerations:
|
||||
{{ toYaml .Values.tolerations | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.schedulerName }}
|
||||
schedulerName: "{{ .Values.schedulerName }}"
|
||||
{{- end }}
|
||||
{{- if .Values.affinity }}
|
||||
affinity:
|
||||
{{ toYaml .Values.affinity | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml .Values.nodeSelector | indent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ template "zookeeper.name" . }}-server
|
||||
imagePullPolicy: {{ .Values.imagePullPolicy }}
|
||||
image: gcr.io/google_samples/k8szk:v2
|
||||
resources:
|
||||
{{ toYaml .Values.resources | indent 10 }}
|
||||
ports:
|
||||
- containerPort: {{ .Values.clientPort }}
|
||||
name: client
|
||||
- containerPort: {{ .Values.serverPort }}
|
||||
name: server
|
||||
- containerPort: {{ .Values.leaderElectionPort }}
|
||||
name: leader-election
|
||||
env:
|
||||
- name : ZK_REPLICAS
|
||||
value: "{{ .Values.servers }}"
|
||||
- name : ZK_HEAP_SIZE
|
||||
value: "{{ .Values.heap }}"
|
||||
- name : ZK_TICK_TIME
|
||||
value: "{{ .Values.tickTimeMs }}"
|
||||
- name : ZK_INIT_LIMIT
|
||||
value: "{{ .Values.initTicks }}"
|
||||
- name : ZK_SYNC_LIMIT
|
||||
value: "{{ .Values.syncTicks }}"
|
||||
- name : ZK_MAX_CLIENT_CNXNS
|
||||
value: "{{ .Values.clientCnxns }}"
|
||||
- name: ZK_SNAP_RETAIN_COUNT
|
||||
value: "{{ .Values.snapRetain }}"
|
||||
- name: ZK_PURGE_INTERVAL
|
||||
value: "{{ .Values.purgeHours }}"
|
||||
- name: ZK_LOG_LEVEL
|
||||
value: {{ .Values.logLevel }}
|
||||
- name: ZK_CLIENT_PORT
|
||||
value: "{{ .Values.clientPort }}"
|
||||
- name: ZK_SERVER_PORT
|
||||
value: "{{ .Values.serverPort }}"
|
||||
- name: ZK_ELECTION_PORT
|
||||
value: "{{ .Values.leaderElectionPort }}"
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- zkGenConfig.sh && exec zkServer.sh start-foreground
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- "zkOk.sh"
|
||||
initialDelaySeconds: {{ .Values.probeInitialDelaySeconds }}
|
||||
timeoutSeconds: {{ .Values.probeTimeoutSeconds }}
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- "zkOk.sh"
|
||||
initialDelaySeconds: {{ .Values.probeInitialDelaySeconds }}
|
||||
timeoutSeconds: {{ .Values.probeTimeoutSeconds }}
|
||||
volumeMounts:
|
||||
- name: datadir
|
||||
mountPath: /var/lib/zookeeper
|
||||
subPath: data
|
||||
{{ if not .Values.persistence.enabled }}
|
||||
volumes:
|
||||
- name: datadir
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- if eq .Values.security.enabled true }}
|
||||
securityContext:
|
||||
runAsUser: {{ .Values.security.runAsUser }}
|
||||
fsGroup: {{ .Values.security.fsGroup }}
|
||||
{{- end }}
|
||||
{{- if .Values.persistence.enabled }}
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: datadir
|
||||
spec:
|
||||
accessModes: [ "ReadWriteOnce" ]
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size }}
|
||||
{{- if .Values.persistence.storageClass }}
|
||||
{{- if (eq "-" .Values.persistence.storageClass) }}
|
||||
storageClassName: ""
|
||||
{{- else }}
|
||||
storageClassName: "{{ .Values.persistence.storageClass }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{ toYaml .Values.securityContext | indent 8 }}
|
||||
containers:
|
||||
|
||||
- name: zookeeper
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
command:
|
||||
- /bin/bash
|
||||
- -xec
|
||||
- zkGenConfig.sh && exec zkServer.sh start-foreground
|
||||
ports:
|
||||
{{- range $key, $port := .Values.ports }}
|
||||
- name: {{ $key }}
|
||||
{{ toYaml $port | indent 14 }}
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
{{ toYaml .Values.livenessProbe | indent 12 }}
|
||||
readinessProbe:
|
||||
{{ toYaml .Values.readinessProbe | indent 12 }}
|
||||
env:
|
||||
- name: ZK_REPLICAS
|
||||
value: {{ .Values.replicaCount | quote }}
|
||||
{{- range $key, $value := .Values.env }}
|
||||
- name: {{ $key | upper | replace "." "_" }}
|
||||
value: {{ $value | quote }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{ toYaml .Values.resources | indent 12 }}
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /var/lib/zookeeper
|
||||
|
||||
{{- if .Values.exporters.jmx.enabled }}
|
||||
- name: jmx-exporter
|
||||
image: "{{ .Values.exporters.jmx.image.repository }}:{{ .Values.exporters.jmx.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.exporters.jmx.image.pullPolicy }}
|
||||
ports:
|
||||
{{- range $key, $port := .Values.exporters.jmx.ports }}
|
||||
- name: {{ $key }}
|
||||
{{ toYaml $port | indent 14 }}
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
{{ toYaml .Values.exporters.jmx.livenessProbe | indent 12 }}
|
||||
readinessProbe:
|
||||
{{ toYaml .Values.exporters.jmx.readinessProbe | indent 12 }}
|
||||
env:
|
||||
- name: SERVICE_PORT
|
||||
value: {{ .Values.exporters.jmx.ports.jmxxp.containerPort | quote }}
|
||||
{{- with .Values.exporters.jmx.env }}
|
||||
{{- range $key, $value := . }}
|
||||
- name: {{ $key | upper | replace "." "_" }}
|
||||
value: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{ toYaml .Values.exporters.jmx.resources | indent 12 }}
|
||||
volumeMounts:
|
||||
- name: config-jmx-exporter
|
||||
mountPath: /opt/jmx_exporter/config.yml
|
||||
subPath: config.yml
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.exporters.zookeeper.enabled }}
|
||||
- name: zookeeper-exporter
|
||||
image: "{{ .Values.exporters.zookeeper.image.repository }}:{{ .Values.exporters.zookeeper.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.exporters.zookeeper.image.pullPolicy }}
|
||||
args:
|
||||
- -bind-addr=:{{ .Values.exporters.zookeeper.ports.zookeeperxp.containerPort }}
|
||||
- -metrics-path={{ .Values.exporters.zookeeper.path }}
|
||||
- -zookeeper=localhost:{{ .Values.ports.client.containerPort }}
|
||||
- -log-level={{ .Values.exporters.zookeeper.config.logLevel }}
|
||||
- -reset-on-scrape={{ .Values.exporters.zookeeper.config.resetOnScrape }}
|
||||
ports:
|
||||
{{- range $key, $port := .Values.exporters.zookeeper.ports }}
|
||||
- name: {{ $key }}
|
||||
{{ toYaml $port | indent 14 }}
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
{{ toYaml .Values.exporters.zookeeper.livenessProbe | indent 12 }}
|
||||
readinessProbe:
|
||||
{{ toYaml .Values.exporters.zookeeper.readinessProbe | indent 12 }}
|
||||
env:
|
||||
{{- range $key, $value := .Values.exporters.zookeeper.env }}
|
||||
- name: {{ $key | upper | replace "." "_" }}
|
||||
value: {{ $value | quote }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{ toYaml .Values.exporters.zookeeper.resources | indent 12 }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.exporters.jmx.enabled }}
|
||||
volumes:
|
||||
- name: config-jmx-exporter
|
||||
configMap:
|
||||
name: {{ .Release.Name }}-jmx-exporter
|
||||
{{- end }}
|
||||
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: data
|
||||
spec:
|
||||
accessModes:
|
||||
- {{ .Values.persistence.accessMode | quote }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size | quote }}
|
||||
{{- if .Values.persistence.storageClass }}
|
||||
{{- if (eq "-" .Values.persistence.storageClass) }}
|
||||
storageClassName: ""
|
||||
{{- else }}
|
||||
storageClassName: "{{ .Values.persistence.storageClass }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
+283
-82
@@ -1,93 +1,294 @@
|
||||
# Default values for zookeeper.
|
||||
# This is a YAML-formatted file.
|
||||
# Declare name/value pairs to be passed into your templates.
|
||||
# name: value
|
||||
servers: 3
|
||||
## As weighted quorums are not supported, it is imperative that an odd number of replicas
|
||||
## be chosen. Moreover, the number of replicas should be either 1, 3, 5, or 7.
|
||||
##
|
||||
## ref: https://github.com/kubernetes/contrib/tree/master/statefulsets/zookeeper#stateful-set
|
||||
replicaCount: 3 # Desired quantity of ZooKeeper pods. This should always be (1,3,5, or 7)
|
||||
|
||||
podDisruptionBudget:
|
||||
maxUnavailable: 1 # Limits how many Zokeeper pods may be unavailable due to voluntary disruptions.
|
||||
|
||||
terminationGracePeriodSeconds: 1800 # Duration in seconds a Zokeeper pod needs to terminate gracefully.
|
||||
|
||||
## OnDelete requires you to manually delete each pod when making updates.
|
||||
## This approach is at the moment safer than RollingUpdate because replication
|
||||
## may be incomplete when replication source pod is killed.
|
||||
##
|
||||
## ref: http://blog.kubernetes.io/2017/09/kubernetes-statefulsets-daemonsets.html
|
||||
updateStrategy:
|
||||
type: "OnDelete"
|
||||
# minAvailable: 2
|
||||
resources:
|
||||
requests:
|
||||
cpu: 500m
|
||||
memory: 2Gi
|
||||
limits:
|
||||
cpu: 1
|
||||
memory: 4Gi
|
||||
heap: "2G"
|
||||
serverPort: 2888
|
||||
leaderElectionPort: 3888
|
||||
clientPort: 2181
|
||||
imagePullPolicy: "Always"
|
||||
tickTimeMs: 2000
|
||||
initTicks: 10
|
||||
syncTicks: 5
|
||||
clientCnxns: 60
|
||||
snapRetain: 3
|
||||
purgeHours: 1
|
||||
probeInitialDelaySeconds: 15
|
||||
probeTimeoutSeconds: 5
|
||||
logLevel: "INFO"
|
||||
security:
|
||||
enabled: false
|
||||
runAsUser: 1000
|
||||
type: OnDelete # Pods will only be created when you manually delete old pods.
|
||||
|
||||
## refs:
|
||||
## - https://github.com/kubernetes/contrib/tree/master/statefulsets/zookeeper
|
||||
## - https://github.com/kubernetes/contrib/blob/master/statefulsets/zookeeper/Makefile#L1
|
||||
image:
|
||||
repository: gcr.io/google_samples/k8szk # Container image repository for zookeeper container.
|
||||
tag: v3 # Container image tag for zookeeper container.
|
||||
pullPolicy: IfNotPresent # Image pull criteria for zookeeper container.
|
||||
|
||||
service:
|
||||
type: ClusterIP # Exposes zookeeper on a cluster-internal IP.
|
||||
annotations: {} # Arbitrary non-identifying metadata for zookeeper service.
|
||||
## AWS example for use with LoadBalancer service type.
|
||||
# external-dns.alpha.kubernetes.io/hostname: zookeeper.cluster.local
|
||||
# service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled: "true"
|
||||
# service.beta.kubernetes.io/aws-load-balancer-internal: "true"
|
||||
ports:
|
||||
client:
|
||||
port: 2181 # Service port number for client port.
|
||||
targetPort: client # Service target port for client port.
|
||||
protocol: TCP # Service port protocol for client port.
|
||||
|
||||
|
||||
ports:
|
||||
client:
|
||||
containerPort: 2181 # Port number for zookeeper container client port.
|
||||
protocol: TCP # Protocol for zookeeper container client port.
|
||||
election:
|
||||
containerPort: 3888 # Port number for zookeeper container election port.
|
||||
protocol: TCP # Protocol for zookeeper container election port.
|
||||
server:
|
||||
containerPort: 2888 # Port number for zookeeper container server port.
|
||||
protocol: TCP # Protocol for zookeeper container server port.
|
||||
|
||||
resources: {} # Optionally specify how much CPU and memory (RAM) each zookeeper container needs.
|
||||
# We usually recommend not to specify default resources and to leave this as a conscious
|
||||
# choice for the user. This also increases chances charts run on environments with little
|
||||
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
||||
# limits:
|
||||
# cpu: 100m
|
||||
# memory: 128Mi
|
||||
# requests:
|
||||
# cpu: 100m
|
||||
# memory: 128Mi
|
||||
|
||||
nodeSelector: {} # Node label-values required to run zookeeper pods.
|
||||
|
||||
tolerations: [] # Node taint overrides for zookeeper pods.
|
||||
|
||||
affinity: {} # Criteria by which pod label-values influence scheduling for zookeeper pods.
|
||||
# podAntiAffinity:
|
||||
# requiredDuringSchedulingIgnoredDuringExecution:
|
||||
# - topologyKey: "kubernetes.io/hostname"
|
||||
# labelSelector:
|
||||
# matchLabels:
|
||||
# release: zookeeper
|
||||
|
||||
podAnnotations: {} # Arbitrary non-identifying metadata for zookeeper pods.
|
||||
# prometheus.io/scrape: "true"
|
||||
# prometheus.io/path: "/metrics"
|
||||
# prometheus.io/port: "9141"
|
||||
|
||||
podLabels: {} # Key/value pairs that are attached to zookeeper pods.
|
||||
# team: "developers"
|
||||
# service: "zookeeper"
|
||||
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- zkOk.sh
|
||||
initialDelaySeconds: 20
|
||||
# periodSeconds: 30
|
||||
# timeoutSeconds: 30
|
||||
# failureThreshold: 6
|
||||
# successThreshold: 1
|
||||
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- zkOk.sh
|
||||
initialDelaySeconds: 20
|
||||
# periodSeconds: 30
|
||||
# timeoutSeconds: 30
|
||||
# failureThreshold: 6
|
||||
# successThreshold: 1
|
||||
|
||||
securityContext:
|
||||
fsGroup: 1000
|
||||
runAsUser: 1000
|
||||
|
||||
## Make zookeeper accessible outside of the kubernetes cluster
|
||||
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-loadbalancer
|
||||
##
|
||||
# annotations:
|
||||
# service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0
|
||||
# serviceType: LoadBalancer
|
||||
|
||||
|
||||
## Use an alternate scheduler, e.g. "stork".
|
||||
## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/
|
||||
##
|
||||
# schedulerName:
|
||||
|
||||
# Affinities to add to the worker pods.
|
||||
# Useful if you prefer to run workers on non-spot instances, for example
|
||||
affinity: {}
|
||||
# nodeAffinity:
|
||||
# preferredDuringSchedulingIgnoredDuringExecution:
|
||||
# - weight: 50
|
||||
# preference:
|
||||
# matchExpressions:
|
||||
# - key: spot
|
||||
# operator: NotIn
|
||||
# values:
|
||||
# - "true"
|
||||
|
||||
## Node labels for pod assignment
|
||||
## Ref: https://kubernetes.io/docs/user-guide/node-selection/
|
||||
##
|
||||
nodeSelector: {}
|
||||
|
||||
# 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/
|
||||
tolerations: []
|
||||
# tolerations:
|
||||
# - key: "key"
|
||||
# operator: "Equal"
|
||||
# value: "value"
|
||||
# effect: "NoSchedule"
|
||||
#
|
||||
## Persistence configuration. Specify if and how to persist data to a persistent volume.
|
||||
##
|
||||
persistence:
|
||||
enabled: true
|
||||
|
||||
## The size of the PersistentVolume to allocate to each Zookeeper Pod in the StatefulSet. For
|
||||
## production servers this number should likely be much larger.
|
||||
##
|
||||
size: "5Gi"
|
||||
|
||||
## Zookeeper data Persistent Volume Storage Class
|
||||
## zookeeper data Persistent Volume Storage Class
|
||||
## If defined, storageClassName: <storageClass>
|
||||
## If set to "-", storageClassName: "", which disables dynamic provisioning
|
||||
## If undefined (the default) or set to null, no storageClassName spec is
|
||||
## set, choosing the default provisioner. (gp2 on AWS, standard on
|
||||
## GKE, AWS & OpenStack)
|
||||
##
|
||||
# storageClass:
|
||||
# storageClass: "-"
|
||||
accessMode: ReadWriteOnce
|
||||
size: 5Gi
|
||||
|
||||
## Exporters query apps for metrics and make those metrics available for
|
||||
## Prometheus to scrape.
|
||||
exporters:
|
||||
|
||||
jmx:
|
||||
enabled: false
|
||||
image:
|
||||
repository: sscaling/jmx-prometheus-exporter
|
||||
tag: 0.3.0
|
||||
pullPolicy: IfNotPresent
|
||||
config:
|
||||
lowercaseOutputName: false
|
||||
## ref: https://github.com/prometheus/jmx_exporter/blob/master/example_configs/zookeeper.yaml
|
||||
rules:
|
||||
- pattern: "org.apache.ZooKeeperService<name0=ReplicatedServer_id(\\d+)><>(\\w+)"
|
||||
name: "zookeeper_$2"
|
||||
- pattern: "org.apache.ZooKeeperService<name0=ReplicatedServer_id(\\d+), name1=replica.(\\d+)><>(\\w+)"
|
||||
name: "zookeeper_$3"
|
||||
labels:
|
||||
replicaId: "$2"
|
||||
- pattern: "org.apache.ZooKeeperService<name0=ReplicatedServer_id(\\d+), name1=replica.(\\d+), name2=(\\w+)><>(\\w+)"
|
||||
name: "zookeeper_$4"
|
||||
labels:
|
||||
replicaId: "$2"
|
||||
memberType: "$3"
|
||||
- pattern: "org.apache.ZooKeeperService<name0=ReplicatedServer_id(\\d+), name1=replica.(\\d+), name2=(\\w+), name3=(\\w+)><>(\\w+)"
|
||||
name: "zookeeper_$4_$5"
|
||||
labels:
|
||||
replicaId: "$2"
|
||||
memberType: "$3"
|
||||
startDelaySeconds: 30
|
||||
env: {}
|
||||
resources: {}
|
||||
path: /metrics
|
||||
ports:
|
||||
jmxxp:
|
||||
containerPort: 9404
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /metrics
|
||||
port: jmxxp
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 15
|
||||
timeoutSeconds: 60
|
||||
failureThreshold: 8
|
||||
successThreshold: 1
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /metrics
|
||||
port: jmxxp
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 15
|
||||
timeoutSeconds: 60
|
||||
failureThreshold: 8
|
||||
successThreshold: 1
|
||||
|
||||
zookeeper:
|
||||
## refs:
|
||||
## - https://github.com/carlpett/zookeeper_exporter
|
||||
## - https://hub.docker.com/r/josdotso/zookeeper-exporter/
|
||||
## - https://www.datadoghq.com/blog/monitoring-kafka-performance-metrics/#zookeeper-metrics
|
||||
enabled: false
|
||||
image:
|
||||
repository: josdotso/zookeeper-exporter
|
||||
tag: v1.1.2
|
||||
pullPolicy: IfNotPresent
|
||||
config:
|
||||
logLevel: info
|
||||
resetOnScrape: "true"
|
||||
env: {}
|
||||
resources: {}
|
||||
path: /metrics
|
||||
ports:
|
||||
zookeeperxp:
|
||||
containerPort: 9141
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /metrics
|
||||
port: zookeeperxp
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 15
|
||||
timeoutSeconds: 60
|
||||
failureThreshold: 8
|
||||
successThreshold: 1
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /metrics
|
||||
port: zookeeperxp
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 15
|
||||
timeoutSeconds: 60
|
||||
failureThreshold: 8
|
||||
successThreshold: 1
|
||||
|
||||
## Use an alternate scheduler, e.g. "stork".
|
||||
## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/
|
||||
##
|
||||
# schedulerName:
|
||||
|
||||
## ref: https://github.com/kubernetes/contrib/tree/master/statefulsets/zookeeper
|
||||
env:
|
||||
|
||||
## Options related to JMX exporter.
|
||||
## ref: https://github.com/apache/zookeeper/blob/master/bin/zkServer.sh#L36
|
||||
JMXAUTH: "false"
|
||||
JMXDISABLE: "false"
|
||||
JMXPORT: 1099
|
||||
JMXSSL: "false"
|
||||
|
||||
## The port on which the server will accept client requests.
|
||||
ZK_CLIENT_PORT: 2181
|
||||
|
||||
## The port on which the ensemble performs leader election.
|
||||
ZK_ELECTION_PORT: 3888
|
||||
|
||||
## The JVM heap size.
|
||||
ZK_HEAP_SIZE: 2G
|
||||
|
||||
## The number of Ticks that an ensemble member is allowed to perform leader
|
||||
## election.
|
||||
ZK_INIT_LIMIT: 5
|
||||
|
||||
## The Log Level that for the ZooKeeper processes logger.
|
||||
## Choices are `TRACE,DEBUG,INFO,WARN,ERROR,FATAL`.
|
||||
ZK_LOG_LEVEL: INFO
|
||||
|
||||
## The maximum number of concurrent client connections that
|
||||
## a server in the ensemble will accept.
|
||||
ZK_MAX_CLIENT_CNXNS: 60
|
||||
|
||||
## The maximum session timeout that the ensemble will allow a client to request.
|
||||
## Upstream default is `20 * ZK_TICK_TIME`
|
||||
ZK_MAX_SESSION_TIMEOUT: 40000
|
||||
|
||||
## The minimum session timeout that the ensemble will allow a client to request.
|
||||
## Upstream default is `2 * ZK_TICK_TIME`.
|
||||
ZK_MIN_SESSION_TIMEOUT: 4000
|
||||
|
||||
## The delay, in hours, between ZooKeeper log and snapshot cleanups.
|
||||
ZK_PURGE_INTERVAL: 0
|
||||
|
||||
## The port on which the leader will send events to followers.
|
||||
ZK_SERVER_PORT: 2888
|
||||
|
||||
## The number of snapshots that the ZooKeeper process will retain if
|
||||
## `ZK_PURGE_INTERVAL` is set to a value greater than `0`.
|
||||
ZK_SNAP_RETAIN_COUNT: 3
|
||||
|
||||
## The number of Tick by which a follower may lag behind the ensembles leader.
|
||||
ZK_SYNC_LIMIT: 10
|
||||
|
||||
## The number of wall clock ms that corresponds to a Tick for the ensembles
|
||||
## internal time.
|
||||
ZK_TICK_TIME: 2000
|
||||
|
||||
jobs:
|
||||
## ref: http://zookeeper.apache.org/doc/r3.4.10/zookeeperProgrammers.html#ch_zkSessions
|
||||
chroots:
|
||||
enabled: false
|
||||
activeDeadlineSeconds: 300
|
||||
backoffLimit: 5
|
||||
completions: 1
|
||||
config:
|
||||
create: []
|
||||
# - /kafka
|
||||
# - /ureplicator
|
||||
env: []
|
||||
parallelism: 1
|
||||
resources: {}
|
||||
restartPolicy: Never
|
||||
|
||||
Reference in New Issue
Block a user