y1新建cluster集群redis

一、准备

y1的kubeconfig(脱敏)

yaml 复制代码
apiVersion: v1
kind: Config
clusters:
- name: "yumc1-middleware"
  cluster:
    server: "https://ksrancher.hwwt2.com/k8s/clusters/c-4nmx8"
- name: "yumc1-middleware-172.25.148.232"
  cluster:
    server: "https://172.25.148.232:6443"
    certificate-authority-data: "xxx"
- name: "yumc1-middleware-172.25.148.231"
  cluster:
    server: "https://172.25.148.231:6443"
    certificate-authority-data: "xxx"
- name: "yumc1-middleware-172.25.148.233"
  cluster:
    server: "https://172.25.148.233:6443"
    certificate-authority-data: "xxx"

users:
- name: "yumc1-middleware"
  user:
    token: "xxx"

contexts:
- name: "yumc1-middleware"
  context:
    user: "yumc1-middleware"
    cluster: "yumc1-middleware"
- name: "yumc1-middleware-172.25.148.232"
  context:
    user: "yumc1-middleware"
    cluster: "yumc1-middleware-172.25.148.232"
- name: "yumc1-middleware-172.25.148.231"
  context:
    user: "yumc1-middleware"
    cluster: "yumc1-middleware-172.25.148.231"
- name: "yumc1-middleware-172.25.148.233"
  context:
    user: "yumc1-middleware"
    cluster: "yumc1-middleware-172.25.148.233"

current-context: "yumc1-middleware"
  1. redis yaml文件

cluster模式的redis yaml文件

yaml 复制代码
apiVersion: cache.tongdun.net/v1alpha1
kind: RedisCluster
metadata:
  name: redis-cluster-cpos-01  
  namespace: redis
spec:
  app: cluster-cpos-01  # 取name中redis-* 后的值, pod之间共享资源根据该标签
  capacity: 8192
  dc: sh
  env: production
  image: harbor.hwwt2.com/ops/redis-cluster:latest
  monitorimage: harbor.hwwt2.com/ops/redis-exporter:latest
  netmode: ClusterIP
  proxyimage: ""      # 原项目代理密码 废弃
  proxysecret: ""     # 原项目代理密码 废弃
  realname: dba 
  secret: 'TKYdUe7pfT'          # redis密码设置 可以为空
  size: 3             # 初始redis集群主节点 也是slot分段数量  单台节点最高容量32GB 所以如128GB,就是至少为4
  storageclass: ""    # 目前都是本地盘
  vip: ""             # 暂时废弃
  labels:              
    plt: cpos
    sid: "1115"
    srv: cpos-redis-cluster-gray 

注意:

Image 和 monitorimage ,y0和y1不是一样,需要注意。

y1_k8s image: harbor.hwwt2.com/ops/redis-cluster:latest monitorimage: harbor.hwwt2.com/ops/redis-exporter:latest
y0_k8s image: harbor.hwwt2.com/ops/redis-cluster:test0.3monitorimage: harbor.hwwt2.com/ops/redis-exporter:paas1.0

HA模式的redis yaml文件

yaml 复制代码
apiVersion: cache.tongdun.net/v1alpha1
kind: RedisStandby
metadata:
  name: redis-standby-kfc-storeinfo
  namespace: redis
spec:
  app: standby-kfc-storeinfo
  capacity: 8192   # redis容量
  dc: sh
  env: production
  image: harbor.hwwt2.com/ops/op-redis-5.0.9:v2
  monitorimage: harbor.hwwt2.com/ops/redis-exporter:paas1.0
  netmode: ClusterIP
  realname: dba
  secret: '2ghlmvl_AP'
  sentinelimage: harbor.hwwt2.com/ops/sentinel-standby:v1
  storageclass: ''
  vip: ''
  labels:              # 百胜云监控需要的标签
    plt: ecselection
    sid: "1005"
    srv: ecselection-redis-kfc-storeinfo
---
  1. git信息

redis的yaml文件记录在git中

code.hwwt2.com/osc/_source...

rancher地址

ksrancher.hwwt2.com/p/c-4nmx8:p...

二、操作

查询已有的redis

ini 复制代码
# 
kubectl --kubeconfig=yumc1_k8s get RedisCluster -n redis
  1. 创建 redis(apply)

ini 复制代码
# cpos 是redis yaml文件
kubectl --kubeconfig=yumc1_k8s apply -f cpos
  1. 验证

ini 复制代码
# 查看创建的 redis-cluster-cpos-01 资源
kubectl --kubeconfig=yumc1_k8s get RedisCluster -n redis

在rancher上验证

三、补充

  1. 最小规格

分片:8G,三分片。

  1. 规格套餐
  2. 白皮书
  3. 删除操作
ini 复制代码
# 删除redis-cluster-cpos01 资源
kubectl --kubeconfig=yumc1_k8s delete RedisCluster redis-cluster-cpos01 -n redis
相关推荐
@大迁世界7 小时前
08.CSS if() 函数
前端·css
Moment7 小时前
小米不仅造车,还造模型?309B参数全开源,深度思考完胜DeepSeek 🐒🐒🐒
前端·人工智能·后端
苏打水com7 小时前
第十六篇:Day46-48 前端安全进阶——从“漏洞防范”到“安全体系”(对标职场“攻防实战”需求)
前端·javascript·css·vue.js·html
5C247 小时前
从思想到实践:前端工程化体系与 Webpack 构建架构深度解析
前端·前端工程化
咕噜企业分发小米8 小时前
如何平衡服务器内存使用率和系统稳定性?
java·服务器·前端
前端无涯8 小时前
react组件(2)---State 与生命周期
前端·react.js
GoldenPlayer8 小时前
Web-Tech:CORS的触发机制
前端
AY呀8 小时前
Vite:现代前端构建工具的革命与实战指南
前端·vue.js·vite
爬山算法8 小时前
Netty(13)Netty中的事件和回调机制
java·前端·算法
前端无涯8 小时前
react组件(3)---组件间的通信
前端·react.js