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
相关推荐
啊阿狸不会拉杆30 分钟前
《计算机网络-自顶向下方法》6.7 回顾:Web页面请求的历程 读书笔记
前端·计算机网络
云上工程笔记1 小时前
四柱记账法和复式记账法有什么区别?复式记账为什么更适合查错和对账
大数据·前端·人工智能
恋猫de小郭1 小时前
Dart Skills CLI 1.0 :AI 时代的 Dart 交付支持
android·前端·flutter
Hilaku1 小时前
为什么技术极强的前端,往往当不好前端 Team Leader?
前端·javascript·程序员
Knight_AL1 小时前
EasyExcel 导入模板踩坑:row.add(““)导致文本格式失效与单元格保护问题解决方案
java·前端·easyexcel
Csvn1 小时前
模板字面量类型:用类型做字符串的正则
前端
倾颜2 小时前
AI Chat 长会话性能实践:消息虚拟化、动态高度与流式滚动设计
前端·react.js·node.js
幸运小圣2 小时前
SSE 与 WebSocket 新手入门:前端实时通信完全指南【JavaScript】
前端·javascript·websocket
艾伦野鸽ggg2 小时前
25级开学 JS 考核题解
前端·javascript
leoZ2312 小时前
2026-09-08-mysql-57-init-walkthrough
前端·javascript·数据库·vue.js·opencv·mysql·adb