일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- Windows10
- service
- deployment
- ffmpeg
- dart
- golang
- Kubernetes
- Shell script
- ebpf
- VSCode
- Python
- docker
- HLS
- configmap
- 행정구역분류
- RTMP
- Java
- macos
- Sysinternals
- wireshark
- android studio
- kubectl
- spring cloud config
- aws cli
- nginx-media-server
- aws
- Android
- Flutter
- Pod
- namespace
Archives
- Today
- Total
woonizzooni
kubernetes - zookeeper 구성 본문
이전글 'redis'의 경우처럼 구동 및 연동 자체에 의미를 두고,
연동 목적에 따른 볼륨크기 조정이나, StatefulSet의 크기 등은 이 곳에 의미를 두지 않음.
Namespace : zoo-ns
Service : zk-hs, zk-cs
PodDisruptionBudget : zk-pdb
StatefulSet(3) : my-zoo
apiVersion: v1
kind: Namespace
metadata:
name: zoo-ns
---
apiVersion: v1
kind: Service
metadata:
namespace: zoo-ns
name: zk-hs
labels:
app: zoo
spec:
ports:
- port: 2888
name: server
- port: 3888
name: leader-election
clusterIP: None
selector:
app: zoo
---
apiVersion: v1
kind: Service
metadata:
namespace: zoo-ns
name: zk-cs
labels:
app: zoo
spec:
ports:
- port: 2181
name: client
selector:
app: zoo
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: zk-pdb
spec:
selector:
matchLabels:
app: zoo
maxUnavailable: 1
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: my-zoo
namespace: zoo-ns
spec:
selector:
matchLabels:
app: zoo
serviceName: zk-hs
replicas: 3
updateStrategy:
type: RollingUpdate
podManagementPolicy: Parallel
template:
metadata:
labels:
app: zoo
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- my-zoo
topologyKey: "kubernetes.io/hostname"
containers:
- name: my-zoo
imagePullPolicy: Always
image: "k8s.gcr.io/kubernetes-zookeeper:1.0-3.4.10"
resources:
limits:
cpu: "100m"
memory: "512Mi"
requests:
cpu: "100m"
memory: "512Mi"
ports:
- containerPort: 2181
name: client
- containerPort: 2888
name: server
- containerPort: 3888
name: leader-election
command:
- sh
- -c
- "start-zookeeper \
--servers=3 \
--data_dir=/var/lib/zookeeper/data \
--data_log_dir=/var/lib/zookeeper/data/log \
--conf_dir=/opt/zookeeper/conf \
--client_port=2181 \
--election_port=3888 \
--server_port=2888 \
--tick_time=2000 \
--init_limit=10 \
--sync_limit=5 \
--heap=512M \
--max_client_cnxns=60 \
--snap_retain_count=3 \
--purge_interval=12 \
--max_session_timeout=40000 \
--min_session_timeout=4000 \
--log_level=INFO"
readinessProbe:
exec:
command:
- sh
- -c
- "zookeeper-ready 2181"
initialDelaySeconds: 10
timeoutSeconds: 5
livenessProbe:
exec:
command:
- sh
- -c
- "zookeeper-ready 2181"
initialDelaySeconds: 10
timeoutSeconds: 5
volumeMounts:
- name: datadir
mountPath: /var/lib/zookeeper
- name: timezone
mountPath: /etc/localtime
volumes:
- hostPath:
path: /usr/share/zoneinfo/Asia/Seoul
name: timezone
securityContext:
runAsUser: 1000
fsGroup: 1000
volumeClaimTemplates:
- metadata:
name: datadir
namespace: zoo-ns
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1G
$ kubectl apply -f ./zoo.yaml
$ kubectl get pod -n zoo-ns
NAME READY STATUS RESTARTS AGE
zoo-0 1/1 Running 0 ..
zoo-1 1/1 Running 0 ..
zoo-2 1/1 Running 0 ..
> 주키퍼 접속 주소 : zk-cs.zoo-ns:2181
[참고]
kubernetes.io/ko/docs/tutorials/stateful-application/zookeeper/
'Kubernetes' 카테고리의 다른 글
kubernetes - NGINX MEDIA SERVER 구동하기 (0) | 2020.11.08 |
---|---|
kubernetes - network trouble-shooting tools관련 (0) | 2020.11.05 |
kubernetes - kubectl JSONPath 사용 예제 (0) | 2020.11.05 |
kubernetes - kube-prompt (0) | 2020.11.05 |
kubernetes - redis 실행하기 (개발 환경용) (0) | 2020.11.05 |
Comments