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
相关推荐
Filotimo_1 天前
2.CSS3.(2).html
前端·css
yinuo1 天前
uniapp微信小程序华为鸿蒙定时器熄屏停止
前端
gnip1 天前
vite中自动根据约定目录生成路由配置
前端·javascript
前端橙一陈1 天前
LocalStorage Token vs HttpOnly Cookie 认证方案
前端·spring boot
~无忧花开~1 天前
JavaScript学习笔记(十五):ES6模板字符串使用指南
开发语言·前端·javascript·vue.js·学习·es6·js
泰迪智能科技011 天前
图书推荐丨Web数据可视化(ECharts 5)(微课版)
前端·信息可视化·echarts
CodeCraft Studio1 天前
借助Aspose.Email,使用 Python 读取 Outlook MSG 文件
前端·python·outlook·aspose·email·msg·python读取msg文件
家里有只小肥猫1 天前
react 初体验2
前端·react.js·前端框架
慧慧吖@1 天前
前端发送请求时,参数的传递格式
前端
L李什么李1 天前
HTML——使用表格制作简历
前端·javascript·html