微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐