k8s部署redis集群

kind: Service
apiVersion: v1
metadata:
  name: redis-cluster
spec:
  type: NodePort
  ports:
  - name: redis1
    port: 7000
    nodePort: 31070
    targetPort: 7000
    protocol: TCP
  - name: redis2
    port: 7001
    nodePort: 31071
    targetPort: 7001
    protocol: TCP
  - name: redis3
    port: 7002
    nodePort: 31072
    targetPort: 7002
    protocol: TCP
  - name: redis4
    port: 7003
    nodePort: 31073
    targetPort: 7003
    protocol: TCP
  - name: redis5
    port: 7004
    nodePort: 31074
    targetPort: 7004
    protocol: TCP
  - name: redis6
    port: 7005
    nodePort: 31075
    targetPort: 7005
    protocol: TCP
  selector:
    name: redis-cluster
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: redis-cluster
spec:
  replicas: 1
  selector:
    matchLabels:
      name: redis-cluster
  template:
    metadata:
      labels:
        name: redis-cluster
    spec:
      containers:
      - name: redis-cluster
        image: grokzen/redis-cluster
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 7000
          name: redis1
          protocol: TCP
        - containerPort: 7001
          name: redis2
          protocol: TCP
        - containerPort: 7002
          name: redis3
          protocol: TCP
        - containerPort: 7003
          name: redis4
          protocol: TCP
        - containerPort: 7004
          name: redis5
          protocol: TCP
        - containerPort: 7005
          name: redis6
          protocol: TCP
上一篇:网络协议(protocol )概述


下一篇:Springboot设置跨域的三种方式