Skip to content

Commit e9e6b24

Browse files
authored
Merge pull request #107 from Yolean/yolean-topic-management
Embrace auto.topic.create; trust defaults for production topics
2 parents d01c128 + 096e3bd commit e9e6b24

File tree

3 files changed

+25
-56
lines changed

3 files changed

+25
-56
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ For clusters that enfoce [RBAC](https://kubernetes.io/docs/admin/authorization/r
6868
kubectl apply -f rbac-namespace-default/
6969
```
7070

71+
For example rack awareness can fail without this, `logs -c init-config` showing `Error from server (Forbidden): pods "kafka-0" is forbidden: User "system:serviceaccount:kafka:default" cannot get pods in the namespace "kafka": Unknown user "system:serviceaccount:kafka:default"`.
72+
7173
## Tests
7274

7375
Tests are based on the [kube-test](https://github.com/Yolean/kube-test) concept.

kafka/10broker-config.yml

Lines changed: 23 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ data:
2323
sed -i "s/#init#broker.rack=#init#/broker.rack=$ZONE/" /etc/kafka/server.properties
2424
fi
2525
26+
# This requires additional RBAC, and won't be needed after https://github.com/kubernetes/kubernetes/pull/55329
2627
kubectl -n $POD_NAMESPACE label pod $POD_NAME kafka-broker-id=$KAFKA_BROKER_ID
2728
2829
OUTSIDE_HOST=$(kubectl get node "$NODE_NAME" -o jsonpath='{.status.addresses[?(@.type=="InternalIP")].address}')
@@ -35,22 +36,26 @@ data:
3536
}
3637
3738
server.properties: |-
38-
# Licensed to the Apache Software Foundation (ASF) under one or more
39-
# contributor license agreements. See the NOTICE file distributed with
40-
# this work for additional information regarding copyright ownership.
41-
# The ASF licenses this file to You under the Apache License, Version 2.0
42-
# (the "License"); you may not use this file except in compliance with
43-
# the License. You may obtain a copy of the License at
44-
#
45-
# http://www.apache.org/licenses/LICENSE-2.0
46-
#
47-
# Unless required by applicable law or agreed to in writing, software
48-
# distributed under the License is distributed on an "AS IS" BASIS,
49-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
50-
# See the License for the specific language governing permissions and
51-
# limitations under the License.
52-
53-
# see kafka.server.KafkaConfig for additional details and defaults
39+
############################# Log Basics #############################
40+
41+
# A comma seperated list of directories under which to store log files
42+
# Overrides log.dir
43+
log.dirs=/var/lib/kafka/data/topics
44+
45+
# The default number of log partitions per topic. More partitions allow greater
46+
# parallelism for consumption, but this will also result in more files across
47+
# the brokers.
48+
num.partitions=1
49+
50+
default.replication.factor=3
51+
52+
min.insync.replicas=2
53+
54+
auto.create.topics.enable=true
55+
56+
# The number of threads per data directory to be used for log recovery at startup and flushing at shutdown.
57+
# This value is recommended to be increased for installations with data dirs located in RAID array.
58+
num.recovery.threads.per.data.dir=1
5459
5560
############################# Server Basics #############################
5661
@@ -96,21 +101,6 @@ data:
96101
# The maximum size of a request that the socket server will accept (protection against OOM)
97102
socket.request.max.bytes=104857600
98103
99-
100-
############################# Log Basics #############################
101-
102-
# A comma seperated list of directories under which to store log files
103-
log.dirs=/tmp/kafka-logs
104-
105-
# The default number of log partitions per topic. More partitions allow greater
106-
# parallelism for consumption, but this will also result in more files across
107-
# the brokers.
108-
num.partitions=1
109-
110-
# The number of threads per data directory to be used for log recovery at startup and flushing at shutdown.
111-
# This value is recommended to be increased for installations with data dirs located in RAID array.
112-
num.recovery.threads.per.data.dir=1
113-
114104
############################# Internal Topic Settings #############################
115105
# The replication factor for the group metadata internal topics "__consumer_offsets" and "__transaction_state"
116106
# For anything other than development testing, a value greater than 1 is recommended for to ensure availability such as 3.
@@ -143,7 +133,7 @@ data:
143133
# from the end of the log.
144134
145135
# The minimum age of a log file to be eligible for deletion due to age
146-
log.retention.hours=168
136+
log.retention.hours=-1
147137
148138
# A size-based retention policy for logs. Segments are pruned from the log as long as the remaining
149139
# segments don't drop below log.retention.bytes. Functions independently of log.retention.hours.
@@ -163,7 +153,7 @@ data:
163153
# server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002".
164154
# You can also append an optional chroot string to the urls to specify the
165155
# root directory for all kafka znodes.
166-
zookeeper.connect=localhost:2181
156+
zookeeper.connect=zookeeper:2181
167157
168158
# Timeout in ms for connecting to zookeeper
169159
zookeeper.connection.timeout.ms=6000
@@ -179,21 +169,6 @@ data:
179169
group.initial.rebalance.delay.ms=0
180170
181171
log4j.properties: |-
182-
# Licensed to the Apache Software Foundation (ASF) under one or more
183-
# contributor license agreements. See the NOTICE file distributed with
184-
# this work for additional information regarding copyright ownership.
185-
# The ASF licenses this file to You under the Apache License, Version 2.0
186-
# (the "License"); you may not use this file except in compliance with
187-
# the License. You may obtain a copy of the License at
188-
#
189-
# http://www.apache.org/licenses/LICENSE-2.0
190-
#
191-
# Unless required by applicable law or agreed to in writing, software
192-
# distributed under the License is distributed on an "AS IS" BASIS,
193-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
194-
# See the License for the specific language governing permissions and
195-
# limitations under the License.
196-
197172
# Unspecified loggers and loggers with additivity=true output to server.log and stdout
198173
# Note that INFO only applies to unspecified loggers, the log level of the child logger is used otherwise
199174
log4j.rootLogger=INFO, stdout

kafka/50kafka.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,6 @@ spec:
5757
command:
5858
- ./bin/kafka-server-start.sh
5959
- /etc/kafka/server.properties
60-
- --override
61-
- zookeeper.connect=zookeeper:2181
62-
- --override
63-
- log.retention.hours=-1
64-
- --override
65-
- log.dirs=/var/lib/kafka/data/topics
66-
- --override
67-
- auto.create.topics.enable=false
6860
resources:
6961
requests:
7062
cpu: 100m

0 commit comments

Comments
 (0)