一、文档简介

作者:lanjiaxuan

邮箱:lanheader@163.com

博客地址:https://www.cnblogs.com/lanheader/

更新时间:2021-07-09

安装方式

kubectl apply -f redis.yaml -n xxxxx

安装配置文件

分别创建以下资源的yaml文件,替换上面的redis.yaml执行

创建pvc

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: redis-6379-pvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Gi
storageClassName: "nfs-provisioner" # 这里指定storageClass名称

创建configmap

apiVersion: v1
kind: ConfigMap
metadata:
name: redis-cm
data:
redis_6379.conf: |
protected-mode no
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize no
supervised no
pidfile /var/run/redis_6379.pid
loglevel notice
logfile "/data/redis_6379.log"
databases 16
always-show-logo yes
# requirepass {{ $name.redis.env.passwd }}
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump_6379.rdb
dir /data
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
replica-priority 100
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes
rename-command FLUSHALL SAVEMORE16
rename-command FLUSHDB SAVEDB16
rename-command CONFIG UPDATEC16
rename-command KEYS NOALL16

创建Service

apiVersion: v1
kind: Service
metadata:
name: redis-service
labels:
name: redis-service
spec:
type: ClusterIP # 如果需要集群外部访问,这里改为NodePort
ports:
- port: 6379
protocol: TCP
targetPort: 6379
name: redis-6379
selector:
name: redis # 这里填写Deployment/metadata/name 的值

部署redis

apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: redis
name: redis
spec:
replicas: 1
selector:
matchLabels:
name: redis
template:
metadata:
labels:
name: redis
spec:
containers:
- name: redis-6379
image: redis:5.0
volumeMounts:
- name: configmap-volume
mountPath: /usr/local/etc/redis/redis_6379.conf
subPath: redis_6379.conf
- name: redis-6379
mountPath: "/data"
command:
- "redis-server"
args:
- /usr/local/etc/redis/redis_6379.conf
volumes:
- name: configmap-volume
configMap:
name: redis-cm
items:
- key: redis_6379.conf
path: redis_6379.conf
- name: redis-6379
persistentVolumeClaim:
claimName: redis-6379-pvc # 这里填写pvc的名称

k8s Redis安装部署的更多相关文章

  1. Redis安装部署教程

    1)下载 redis-3.2.9.tar.gz 2)用ssh工具连接目录主机,在命令窗口输入:mkdir -p /opt/redis创建redis文件夹 3)通过WinSCP工具将redis-3.2. ...

  2. Redis安装部署(一主二从三哨兵)

    需求:根据当前客户的生产环境,模拟安装部署Redis的测试环境,方便后续的功能测试. 1.准备工作 2.安装编译Redis 3.Redis运行环境配置 4.Redis启动和关闭 1.准备工作 Redi ...

  3. Redis安装部署、Jedis的使用

    一.NoSQL概述 为什么需要NoSQL High performance -高并发读写 Huge Storage - 海量数据的高效率存储和访问 High Scalability && ...

  4. redis学习(4)redis安装部署

    下载redis-1.2.6.tar.gz 将下载包拷贝到/usr/local/webserver/redis-1.2.6/下 2.安装 tar -zxvf redis-1.2.6.tar.gz ce ...

  5. Kubernetes1.91(K8s)安装部署过程(八)-- kubernetes-dashboard安装

    kubernets-dashboard顾名思义是操作面板安装,也就是可视化管理机器,同意我们用镜像结合配置文件部署. 1.下载镜像: docker pull registry.docker-cn.co ...

  6. Redis 安装部署

    1. 官网(https://redis.io/download)下载稳定版安装包 3.0.7或3.2或4.1; 2. 复制到部署服务器 /opt/redis4,解压 tar zxvf redis-4. ...

  7. Kubernetes1.91(K8s)安装部署过程(七)--coredns安装

    为了是集群内的服务能使用dns进行服务解析,集群内需要使用dns服务器,可以按照kube官方dns,即kubedns或者其他的dns,比如coredns, 本例中按照的为coredns,按照简单,编辑 ...

  8. Kubernetes1.91(K8s)安装部署过程(一)--证书安装

    安装前忠告:如果你用的是虚拟机,强烈不建议你使用克隆(链接克隆)的方式,至于完整克隆不知道有没有问题,每一台全新安装centos7系统最好. 一.安装前主题环境准备 1.docker安装 建议使用官网 ...

  9. K8s+dashboard安装部署【h】

    系统安装使用虚拟机安装两个centos系统,在/etc/hosts里增加两行192.168.140.128 kuber-master192.168.140.129 kuber-node1 关闭防火墙s ...

  10. K8S的安装部署以及基础知识

    Kubernetes(K8S)概述 Kubernetes又称作k8s,是Google在2014年发布的一个开源项目. 最初Google开发了一个叫Borg的系统(现在命名为Omega),来调度近20多 ...

随机推荐

  1. async/await初学者指南

    JavaScript中的async和await关键字提供了一种现代语法,帮助我们处理异步操作.在本教程中,我们将深入研究如何使用async/await来掌控JavaScript程序中的流程控制. 总览 ...

  2. Kernel panic 堆栈信息怎么看

    Kernel panic 是指 Linux 内核遇到了无法继续执行的致命错误,此时会在屏幕上输出一些错误信息,其中就包括堆栈信息.堆栈信息是指发生错误时 CPU 执行的代码路径,可以通过堆栈信息来定位 ...

  3. clickhouse 与 zookeeper

    目录 clickhouse 设置中的 zookeeper 配置 参数说明 配置示例 [预发生产] ClickHouse Keeper 四字母命令 clickhouse 设置中的 zookeeper 配 ...

  4. VSCode:缩进两格空格

    在设定中对如图所示两项进行修改: 至此问题解决.

  5. UiAutomator2.0(转)

    1.     概述 UI测试(功能测试.黑盒测试)不需要测试者了解应用程序的内部实现细节,只需要知道当执行了某些特定的动作后是否会得到其预期的输出.这种测试方法,在团队合作中可以更好地分离的开发和测试 ...

  6. Cilium系列-13-启用XDP加速及Cilium性能调优总结

    系列文章 Cilium 系列文章 前言 将 Kubernetes 的 CNI 从其他组件切换为 Cilium, 已经可以有效地提升网络的性能. 但是通过对 Cilium 不同模式的切换/功能的启用, ...

  7. 利用选项卡提高Visual Studio 2022开发效率

    设计器作为软件开发的必要工具,其效率的提高显得尤为重要.Visual Studio 2022作为一款功能强大的设计器,通过选项卡提高了工作效率,让开发者在使用过程中更加便捷. 在Visual Stud ...

  8. Python生成30万条Excel 测试数据

    使用Python生成30万条Excel 测试数据 from openpyxl import Workbook from concurrent.futures import ThreadPoolExec ...

  9. API接口设计规范,看这篇就足以了

    ​ 优秀的设计是产品变得卓越的原因.设计API意味着提供有效的接口,可以帮助API使用者更好地了解.使用和集成,同时帮助人们有效地维护它.每个产品都需要使用手册,API也不例外. 在API领域,可以将 ...

  10. QA|20221001|SecureCRT自动断开怎么办?

    Q:SecureCRT自动断开怎么办? A:如下设置