Created
June 12, 2017 15:47
-
-
Save FuzzOli87/6d12b682e35179a7c3822173d6238756 to your computer and use it in GitHub Desktop.
stateful services
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: kafka-headless-svc | |
labels: | |
app: kafka | |
namespace: core-applications | |
spec: | |
ports: | |
- port: 9092 | |
name: server | |
clusterIP: None | |
selector: | |
app: kafka |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1beta1 | |
kind: StatefulSet | |
metadata: | |
name: kafka | |
namespace: core-applications | |
spec: | |
serviceName: kafka-headless-svc | |
replicas: 3 | |
template: | |
metadata: | |
labels: | |
app: kafka | |
spec: | |
affinity: | |
podAntiAffinity: | |
requiredDuringSchedulingIgnoredDuringExecution: | |
- labelSelector: | |
matchExpressions: | |
- key: "app" | |
operator: In | |
values: | |
- kafka | |
topologyKey: "kubernetes.io/hostname" | |
podAffinity: | |
preferredDuringSchedulingIgnoredDuringExecution: | |
- weight: 1 | |
podAffinityTerm: | |
labelSelector: | |
matchExpressions: | |
- key: "app" | |
operator: In | |
values: | |
- zk | |
topologyKey: "kubernetes.io/hostname" | |
terminationGracePeriodSeconds: 300 | |
containers: | |
- name: pk-ubuntu-kafka | |
imagePullPolicy: Always | |
image: quay.io/parkhubprime/pk-ubuntu-kafka:0.1.0 | |
resources: | |
requests: | |
memory: "1Gi" | |
cpu: 500m | |
ports: | |
- containerPort: 9092 | |
name: server | |
env: | |
- name: KAFKA_ZOOKEEPER_CONNECT | |
value: "zk-0.zk-headless.core-applications.svc.cluster.local:2181,zk-1.zk-headless.core-applications.svc.cluster.local:2181,zk-2.zk-headless.core-applications.svc.cluster.local:2181,zk-3.zk-headless.core-applications.svc.cluster.local:2181,zk-4.zk-headless.core-applications.svc.cluster.local:2181" | |
- name: KAFKA_ADVERTISED_LISTENERS | |
value: "PLAINTEXT://:9092" | |
- name: BROKER_ID_COMMAND | |
value: "hostname | awk -F'-' '{print $2}'" | |
volumeMounts: | |
- name: datadir | |
mountPath: /kafka | |
readinessProbe: | |
exec: | |
command: | |
- sh | |
- -c | |
- "/opt/kafka/bin/kafka-broker-api-versions.sh --bootstrap-server=localhost:9092" | |
securityContext: | |
runAsUser: 1000 | |
fsGroup: 1000 | |
volumeClaimTemplates: | |
- metadata: | |
name: datadir | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
storageClassName: "high-throughput-hdd" | |
resources: | |
requests: | |
storage: 500Gi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: zk-headless | |
namespace: core-applications | |
labels: | |
app: zk-headless | |
spec: | |
ports: | |
- port: 2888 | |
name: server | |
- port: 3888 | |
name: leader-election | |
clusterIP: None | |
selector: | |
app: zk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1beta1 | |
kind: StatefulSet | |
metadata: | |
name: zk | |
namespace: core-applications | |
spec: | |
serviceName: zk-headless | |
replicas: 5 | |
template: | |
metadata: | |
labels: | |
app: zk | |
spec: | |
terminationGracePeriodSeconds: 10 | |
affinity: | |
podAntiAffinity: | |
requiredDuringSchedulingIgnoredDuringExecution: | |
- labelSelector: | |
matchExpressions: | |
- key: "app" | |
operator: In | |
values: | |
- zk | |
topologyKey: "kubernetes.io/hostname" | |
containers: | |
- name: pk-ubuntu-zookeeper | |
imagePullPolicy: Always | |
image: quay.io/parkhubprime/pk-ubuntu-zookeeper:0.1.0 | |
resources: | |
requests: | |
memory: "2Gi" | |
cpu: "500m" | |
ports: | |
- containerPort: 2181 | |
name: client | |
- containerPort: 2888 | |
name: server | |
- containerPort: 3888 | |
name: leader-election | |
env: | |
- name: ZK_REPLICAS | |
value: "5" | |
- name: ZK_HEAP_SIZE | |
valueFrom: | |
configMapKeyRef: | |
name: zk-cm | |
key: jvm.heap | |
- name : ZK_TICK_TIME | |
valueFrom: | |
configMapKeyRef: | |
name: zk-cm | |
key: tick | |
- name : ZK_INIT_LIMIT | |
valueFrom: | |
configMapKeyRef: | |
name: zk-cm | |
key: init | |
- name : ZK_SYNC_LIMIT | |
valueFrom: | |
configMapKeyRef: | |
name: zk-cm | |
key: tick | |
- name : ZK_MAX_CLIENT_CNXNS | |
valueFrom: | |
configMapKeyRef: | |
name: zk-cm | |
key: client.cnxns | |
- name: ZK_SNAP_RETAIN_COUNT | |
valueFrom: | |
configMapKeyRef: | |
name: zk-cm | |
key: snap.retain | |
- name: ZK_PURGE_INTERVAL | |
valueFrom: | |
configMapKeyRef: | |
name: zk-cm | |
key: purge.interval | |
- name: ZK_CLIENT_PORT | |
value: "2181" | |
- name: ZK_SERVER_PORT | |
value: "2888" | |
- name: ZK_ELECTION_PORT | |
value: "3888" | |
readinessProbe: | |
exec: | |
command: | |
- "zkOk.sh" | |
initialDelaySeconds: 10 | |
timeoutSeconds: 5 | |
livenessProbe: | |
exec: | |
command: | |
- "zkOk.sh" | |
initialDelaySeconds: 10 | |
timeoutSeconds: 5 | |
volumeMounts: | |
- name: datadir | |
mountPath: /var/lib/zookeeper | |
securityContext: | |
runAsUser: 1000 | |
fsGroup: 1000 | |
volumeClaimTemplates: | |
- metadata: | |
name: datadir | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
storageClassName: "high-throughput-hdd" | |
resources: | |
requests: | |
storage: 500Gi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment