其他分享
首页 > 其他分享> > K8S-ELK日志系统 之二:zookeeper集群

K8S-ELK日志系统 之二:zookeeper集群

作者:互联网

接:https://www.cnblogs.com/cnblo/p/15673102.html

此处zookeeper只要为kafaka提供服务发现功能

zookeeper:apache-zookeeper-3.6.3-bin

1、NFS服务器上创建可供zookeeper使用的共享存储

mkdir /datazookeeper

echo "/data/zookeeper *(rw,sync,no_root_squash,no_subtree_check)" >> /etc/exports

exportfs -arv 

NFS地址:10.0.8.131:/data/zookeeper

2、修改nfs-provisoner.yaml增加上面创建的NFS共享目录

增加一个container和volume

账号和权限即绑定 在https://www.cnblogs.com/cnblo/p/15673102.htm中已做

 1 kind: Deployment
 2 apiVersion: apps/v1
 3 metadata:
 4   name: nfs-client-provisioner
 5   namespace: es
 6   labels:
 7     app: nfs-client-provisioner
 8 spec:
 9   replicas: 1
10   strategy:
11     type: Recreate
12   selector:
13     matchLabels:
14       app: nfs-client-provisioner
15   template:
16     metadata:
17       labels:
18         app: nfs-client-provisioner
19     spec:
20       serviceAccount: nfs-provisioner
21       containers:
22         - name: nfs-client-provisioner
23           #          image: quay.io/external_storage/nfs-client-provisioner:latest
24           image: easzlab/nfs-subdir-external-provisioner:v4.0.1
25           volumeMounts:
26             - name: nfs-client-root
27               mountPath: /persistentvolumes
28           env:
29             - name: PROVISIONER_NAME
30               value: nfs-provisioner
31             - name: NFS_SERVER
32               value: 10.0.8.131
33             - name: NFS_PATH
34               value: /data/elasticsearch
35         - name: nfs-zookeeper-provisioner
36           image: easzlab/nfs-subdir-external-provisioner:v4.0.1
37           volumeMounts:
38             - name: nfs-zookeeper-root
39               mountPath: /persistentvolumes
40           env:
41             - name: PROVISIONER_NAME
42               value: nfs-zookeeper-provisioner
43             - name: NFS_SERVER
44               value: 10.0.8.131
45             - name: NFS_PATH
46               value: /data/zookeeper
47       volumes:
48         - name: nfs-client-root
49           nfs:
50             server: 10.0.8.131
51             path: /data/elasticsearch
52         - name: nfs-zookeeper-root
53           nfs:
54             server: 10.0.8.131
55             path: /data/zookeeper
nfs-provisioner.yaml

3、创建storageclass

1 apiVersion: storage.k8s.io/v1
2 kind: StorageClass
3 metadata:
4   name: nfs-zookeeper-storage
5 provisioner: nfs-zookeeper-provisioner
6 parameters:
7   archiveOnDelete: "true"  
storageclass.yaml

4、Dockerfile

使用openjdk8

Dockerfile entrypoint.sh
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/data/zookeeper
clientPort=2181
quorumListenOnAllIPs=true
zoo.cfg

docker build -t harbor.myland.com/baseimages/zookeeper:3.6.3-jdk8-stateful-20211217 .

docker push harbor.myland.com/baseimages/zookeeper:3.6.3-jdk8-stateful-20211217  

 5、验证

  

 

标签:ELK,name,zookeeper,client,nfs,provisioner,NFS,K8S
来源: https://www.cnblogs.com/cnblo/p/15704939.html