Brc's blog
首页
前端
后端
运维
  • 工作笔记
  • 分类
  • 标签
  • 归档
关于

Brc

努力中
首页
前端
后端
运维
  • 工作笔记
  • 分类
  • 标签
  • 归档
关于
  • 工具安装

  • AWS

  • EKS

    • 扩缩容

    • 存储

    • devops

    • test

      • 保密字典
      • redis
      • mysql
      • rabbitmq
      • mongodb
      • consul
        • ConfigMap
        • PersistentVolumeClaim
        • StatefulSet
        • Service-ClusterIP
        • Service-NodePort
        • 导入导出数据
      • xxl-job
      • java
    • CICD

    • 问题
  • 其他

  • AWS创建EKS集群
  • 谷歌云创建GKE集群
  • 工作笔记
  • EKS
  • test
Brc
2023-06-11
目录

consul

# ConfigMap

kind: ConfigMap
apiVersion: v1
metadata:
  name: birenchong-test-consul-conf
  namespace: birenchong-test
  annotations:
    kubesphere.io/creator: admin
data:
  consul.json: |-
    {
    "datacenter": "xys_center",
    "data_dir": "/consul/data",
    "log_level": "INFO",
    "server": true,
    "bootstrap_expect": 1,
    "bind_addr": "127.0.0.1",
    "client_addr": "0.0.0.0",
    "retry_interval": "3s",
    "raft_protocol": 3,
    "enable_debug": false,
    "rejoin_after_leave": true,
    "encrypt": "i+TjXojPyilna4eO+dCeow==",
    "enable_syslog": false
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

# PersistentVolumeClaim

static
birenchong-test-consul-data-pvc
1
2

# StatefulSet

kind: StatefulSet
apiVersion: apps/v1
metadata:
  name: birenchong-test-consul-v1
  namespace: birenchong-test
  labels:
    app: birenchong-test-consul
    version: v1
  annotations:
    kubesphere.io/creator: admin
spec:
  replicas: 1
  selector:
    matchLabels:
      app: birenchong-test-consul
      version: v1
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: birenchong-test-consul
        version: v1
      annotations:
        logging.kubesphere.io/logsidecar-config: '{}'
    spec:
      volumes:
        - name: volume-ul36q5
          persistentVolumeClaim:
            claimName: birenchong-test-consul-data-pvc
        - name: volume-wia637
          configMap:
            name: birenchong-test-consul-conf
            items:
              - key: consul.json
                path: consul.json
            defaultMode: 420
      containers:
        - name: consul
          image: 'consul:1.9.0'
          ports:
            - name: tcp-8300
              containerPort: 8300
              protocol: TCP
            - name: tcp-8301
              containerPort: 8301
              protocol: TCP
            - name: udp-8301
              containerPort: 8301
              protocol: UDP
            - name: tcp-8302
              containerPort: 8302
              protocol: TCP
            - name: udp-8302
              containerPort: 8302
              protocol: UDP
            - name: tcp-8500
              containerPort: 8500
              protocol: TCP
            - name: tcp-8600
              containerPort: 8600
              protocol: TCP
            - name: udp-8600
              containerPort: 8600
              protocol: UDP
          resources: {}
          volumeMounts:
            - name: volume-ul36q5
              mountPath: /consul/data
              subPath: test-consul/data
            - name: volume-wia637
              readOnly: true
              mountPath: /consul/config/consul.json
              subPath: consul.json
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: IfNotPresent
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      dnsPolicy: ClusterFirst
      nodeSelector:
        env: test
      serviceAccountName: default
      serviceAccount: default
      securityContext: {}
      schedulerName: default-scheduler
  serviceName: birenchong-test-consul
  podManagementPolicy: OrderedReady
  updateStrategy:
    type: RollingUpdate
    rollingUpdate:
      partition: 0
  revisionHistoryLimit: 10

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93

# Service-ClusterIP

kind: Service
apiVersion: v1
metadata:
  name: birenchong-test-consul
  namespace: birenchong-test
  labels:
    app: birenchong-test-consul
    version: v1
  annotations:
    kubesphere.io/creator: admin
    kubesphere.io/serviceType: statefulservice
spec:
  ports:
    - name: tcp-8300
      protocol: TCP
      port: 8300
      targetPort: 8300
    - name: tcp-8301
      protocol: TCP
      port: 8301
      targetPort: 8301
    - name: udp-8301
      protocol: UDP
      port: 8301
      targetPort: 8301
    - name: tcp-8302
      protocol: TCP
      port: 8302
      targetPort: 8302
    - name: udp-8302
      protocol: UDP
      port: 8302
      targetPort: 8302
    - name: tcp-8500
      protocol: TCP
      port: 8500
      targetPort: 8500
    - name: tcp-8600
      protocol: TCP
      port: 8600
      targetPort: 8600
    - name: udp-8600
      protocol: UDP
      port: 8600
      targetPort: 8600
  selector:
    app: birenchong-test-consul
  clusterIP: None
  clusterIPs:
    - None
  type: ClusterIP
  sessionAffinity: None
  ipFamilies:
    - IPv4
  ipFamilyPolicy: SingleStack
  internalTrafficPolicy: Cluster

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

# Service-NodePort

kind: Service
apiVersion: v1
metadata:
  name: birenchong-test-consul-np
  namespace: birenchong-test
  labels:
    app: birenchong-test-consul-np
  annotations:
    kubesphere.io/creator: admin
spec:
  ports:
    - name: tcp-8500
      protocol: TCP
      port: 8500
      targetPort: 8500
      nodePort: 30776
  selector:
    app: birenchong-test-consul
    version: v1
  clusterIP: 10.100.144.213
  clusterIPs:
    - 10.100.144.213
  type: NodePort
  sessionAffinity: None
  externalTrafficPolicy: Cluster
  ipFamilies:
    - IPv4
  ipFamilyPolicy: SingleStack
  internalTrafficPolicy: Cluster

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

# 导入导出数据

# 导出所有kv键值对,注意最后一个参数是导出键值对的前缀,为空字符串说明要导出所有
consul kv export '' > ./consul_kv_20230223.json

# 导入
consul kv import @consul_kv_20230223.json

1
2
3
4
5
6
#consul
Last Updated: 2023/11/08, 14:45:54
mongodb
xxl-job

← mongodb xxl-job→

最近更新
01
谷歌云创建GKE集群
07-26
02
ElastiCacheForRedis启用密码
07-26
03
upload-to-gcs
06-29
更多文章>
Theme by Vdoing | Copyright © 2021-2024 Brc | MIT License | 浙ICP备19031881号-4
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式