helm3 安装 redis-ha 高可用集群(过程超详细:包含k8s、nfs、storageclass安装步骤)

2022年6月9日09:08:33

一、资源准备 (所有机器上执行)

主机名 公网 IP 私网 IP
k8s-master01 39.104.173.77 172.24.114.3
k8s-node01 39.104.179.210 172.24.114.4
k8s-node02 39.104.173.12 172.24.114.1
k8s-node03 39.104.177.2 172.24.114.2
  1. 更改主机名
# 在虚拟机 172.24.114.3 上,设置 k8s-master01 节点
hostnamectl set-hostname k8s-master01bash#立马生效# 在虚拟机 172.24.114.4 上,设置 k8s-node01 节点
hostnamectl set-hostname k8s-node01bash#立马生效# 在虚拟机 172.24.114.1 上,设置 k8s-node02 节点
hostnamectl set-hostname k8s-node02bash#立马生效# 在虚拟机 172.24.114.2 上,设置 k8s-node03 节点
hostnamectl set-hostname k8s-node03bash#立马生效
  1. 关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
  1. 允许 iptables 检查桥接流量
cat<<EOF|sudotee /etc/modules-load.d/k8s.conf
br_netfilter
EOFcat<<EOF|sudotee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOFsudo sysctl --system
  1. 将 SELinux 设置为 permissive 模式(相当于将其禁用)
sudo setenforce0sudosed -i's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
  1. 关闭swap(k8s禁止虚拟内存提供性能)
swapoff -ased -ri's/.*swap.*/#&/' /etc/fstab#关闭swap分区
  1. 配置/etc/hosts
# 自定义master与node IP,请根据个人情况修改cat>> /etc/hosts<<EOF
172.28.12.148 master1
172.28.12.149 node1
EOF

6.1 安装docker

#清理过往版本dockersudo yum remove docker\
                  docker-client\
                  docker-client-latest\
                  docker-common\
                  docker-latest\
                  docker-latest-logrotate\
                  docker-logrotate\
                  docker-engine
#安装dockersudo yuminstall -y yum-utilssudo yum-config-manager\
    --add-repo\
    http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.reposudo yum makecache fastsudo yuminstall docker-ce docker-ce-cli containerd.io -ysudo systemctl start dockersudo systemctlenable dockersudo systemctl status docker

6.2 修改docker驱动

执行kubeadm init集群初始化时遇到:

[WARNING IsDockerSystemdCheck]: detected “cgroupfs” as the Docker
cgroup driver. The recommended driver is “systemd”.

[警告IsDockerSystemdCheck]:检测到“cgroupfs”作为Docker cgroup驱动程序。
推荐的驱动程序是“systemd”

#新增配置文件cat>> /etc/docker/daemon.json<<EOF
{
 "exec-opts":["native.cgroupdriver=systemd"]
}
EOF#重启docker
systemctl restart docker
systemctl status docker
  1. 配置阿里云kubernetes软件源
    报错:[Errno -1] repomd.xml signature could not be verified for kubernetes Trying other mirror.
    解决:https://github.com/kubernetes/kubernetes/issues/60134
    处理:repo_gpgcheck=0
cat<<EOF> /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=1
#repo_gpgcheck=1
repo_gpgcheck=0
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF
  1. 安装kubelet kubeadm kubectl
sudo yum update -y#针对修改repo_gpgcheck=0# sudo yum install -y kubelet-1.19.4 kubeadm-1.19.4 kubectl-1.19.4 #可以根据github发布版本,指定# sudo yum install -y kubelet-1.20.0 kubeadm-1.20.0 kubectl-1.20.0 #可以根据github发布版本,指定sudo  yuminstall -y kubelet kubeadm kubectl#最好不要指定版本,默认更新为最新sudo systemctlenable --now kubeletsudo systemctl start kubelet#sudo systemctl status kubelet 此时kubelet还没有正常准备,待kubeadm init后master节点会ok,将node节点join添加后kubelet也会正常

helm3 安装 redis-ha 高可用集群(过程超详细:包含k8s、nfs、storageclass安装步骤)

  • 检查工具安装
yum list installed|grep kubelet
yum list installed|grep kubeadm
yum list installed|grep kubectl

kubelet --version#查看集群版本结果 Kubernetes v1.23.3

二、kubeadm创建集群

  • kubeadm初始化集群 #在master上执行

  • 切记修改为master的IP地址, --apiserver-advertise-address 172.24.114.3

#apiserver-advertise-address 172.28.12.148为master节点IP,根据个人master IP修改
kubeadm init --apiserver-advertise-address172.24.114.3\
--image-repository registry.aliyuncs.com/google_containers\
--pod-network-cidr10.244.0.0/16\
--service-cidr10.96.0.0/12#--kubernetes-version v1.23.3 \ #本行,可以不添加,默认使用最新的版本
  • 此处如果执行失败,可能master的IP填写错误或者未填写 --apiserver-advertise-address
    172.24.114.3
kubeadm reset
  • 然后输入:y
  • 已完成 kubeadm init 重置,重新执行以上命令kubeadm init …
#客户端kubectl接入集群mkdir -p$HOME/.kubesudocp -i /etc/kubernetes/admin.conf$HOME/.kube/configsudochown$(id -u):$(id -g)$HOME/.kube/config

注意:在worker节点上执行

#worker节点添加到集群 ---> 在worker节点node1上执行#自动生成,请保留
kubeadmjoin172.24.114.3:6443 --token bofh8w.5r6qwmvargj3d0do\
    --discovery-token-ca-cert-hash sha256:0724d03bf5ca008808b4dc9c68643c90e54d36733a487dc7d73`在这里插入代码片`0dca35a952b89
[root@iZ0jlhvtxignmaozy30vffZ ~]# kubectl get nodes
NAME                      STATUS     ROLES    AGE     VERSION
iz0jlhvtxignmaozy30vffz   NotReady   master   8m19s   v1.19.4
iz0jlhvtxignmaozy30vfgz   NotReady<none>   21s     v1.19.4
  1. 添加pod网络 flannel --> master节点执行
wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
  • 若上面网址较慢或无反应,请复制一下内容放置 kube-flannel.yml
  • cat kube-flannel.yml
---
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
  name: psp.flannel.unprivileged
  annotations:
    seccomp.security.alpha.kubernetes.io/allowedProfileNames: docker/default
    seccomp.security.alpha.kubernetes.io/defaultProfileName: docker/default
    apparmor.security.beta.kubernetes.io/allowedProfileNames: runtime/default
    apparmor.security.beta.kubernetes.io/defaultProfileName: runtime/default
spec:
  privileged:false
  volumes:
  - configMap
  - secret
  - emptyDir
  - hostPath
  allowedHostPaths:
  - pathPrefix:"/etc/cni/net.d"
  - pathPrefix:"/etc/kube-flannel"
  - pathPrefix:"/run/flannel"
  readOnlyRootFilesystem:false# Users and groups
  runAsUser:
    rule: RunAsAny
  supplementalGroups:
    rule: RunAsAny
  fsGroup:
    rule: RunAsAny# Privilege Escalation
  allowPrivilegeEscalation:false
  defaultAllowPrivilegeEscalation:false# Capabilities
  allowedCapabilities:['NET_ADMIN','NET_RAW']
  defaultAddCapabilities:[]
  requiredDropCapabilities:[]# Host namespaces
  hostPID:false
  hostIPC:false
  hostNetwork:true
  hostPorts:
  - min:0
    max:65535# SELinux
  seLinux:# SELinux is unused in CaaSP
    rule:'RunAsAny'
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: flannel
rules:
- apiGroups:['extensions']
  resources:['podsecuritypolicies']
  verbs:['use']
  resourceNames:['psp.flannel.unprivileged']
- apiGroups:
  -""
  resources:
  - pods
  verbs:
  - get
- apiGroups:
  -""
  resources:
  - nodes
  verbs:
  - list
  -watch
- apiGroups:
  -""
  resources:
  - nodes/status
  verbs:
  - patch
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: flannel
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: flannel
subjects:
- kind: ServiceAccount
  name: flannel
  namespace: kube-system
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: flannel
  namespace: kube-system
---
kind: ConfigMap
apiVersion: v1
metadata:
  name: kube-flannel-cfg
  namespace: kube-system
  labels:
    tier: node
    app: flannel
data:
  cni-conf.json:|{"name":"cbr0","cniVersion":"0.3.1","plugins":[{"type":"flannel","delegate":{"hairpinMode": true,"isDefaultGateway":true}},{"type":"portmap","capabilities":{"portMappings":true}}]}
  net-conf.json:|{"Network":"10.244.0.0/16","Backend":{"Type":"vxlan"}}
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: kube-flannel-ds
  namespace: kube-system
  labels:
    tier: node
    app: flannel
spec:
  selector:
    matchLabels:
      app: flannel
  template:
    metadata:
      labels:
        tier: node
        app: flannel
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: kubernetes.io/os
                operator: In
                values:
                - linux
      hostNetwork:true
      priorityClassName: system-node-critical
      tolerations:
      - operator: Exists
        effect: NoSchedule
      serviceAccountName: flannel
      initContainers:
      - name: install-cni-plugin#image: flannelcni/flannel-cni-plugin:v1.0.1 for ppc64le and mips64le (dockerhub limitations may apply)
        image: rancher/mirrored-flannelcni-flannel-cni-plugin:v1.0.1
        command:
        -cp
        args:
        - -f
        - /flannel
        - /opt/cni/bin/flannel
        volumeMounts:
        - name: cni-plugin
          mountPath: /opt/cni/bin
      - name: install-cni#image: flannelcni/flannel:v0.16.3 for ppc64le and mips64le (dockerhub limitations may apply)
        image: rancher/mirrored-flannelcni-flannel:v0.16.3
        command:
        -cp
        args:
        - -f
        - /etc/kube-flannel/cni-conf.json
        - /etc/cni/net.d/10-flannel.conflist
        volumeMounts:
        - name: cni
          mountPath: /etc/cni/net.d
        - name: flannel-cfg
          mountPath: /etc/kube-flannel/
      containers:
      - name: kube-flannel#image: flannelcni/flannel:v0.16.3 for ppc64le and mips64le (dockerhub limitations may apply)
        image: rancher/mirrored-flannelcni-flannel:v0.16.3
        command:
        - /opt/bin/flanneld
        args:
        - --ip-masq
        - --kube-subnet-mgr
        resources:
          requests:
            cpu:"100m"
            memory:"50Mi"
          limits:
            cpu:"100m"
            memory:"50Mi"
        securityContext:
          privileged:false
          capabilities:
            add:["NET_ADMIN","NET_RAW"]
        env:
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        volumeMounts:
        - name: run
          mountPath: /run/flannel
        - name: flannel-cfg
          mountPath: /etc/kube-flannel/
        - name: xtables-lock
          mountPath: /run/xtables.lock
      volumes:
      - name: run
        hostPath:
          path: /run/flannel
      - name: cni-plugin
        hostPath:
          path: /opt/cni/bin
      - name: cni
        hostPath:
          path: /etc/cni/net.d
      - name: flannel-cfg
        configMap:
          name: kube-flannel-cfg
      - name: xtables-lock
        hostPath:
          path: /run/xtables.lock
          type: FileOrCreate
kubectl apply -f ./kube-flannel.yml#此处应用后node状态由NotReady --> Ready

12.控制面master1查看集群

[root@iZ0jlhvtxignmaozy30vffZ ~]# kubectl get nodes
NAME                      STATUS   ROLES    AGE     VERSION
iz0jlhvtxignmaozy30vffz   Ready    master   11m     v1.19.4
iz0jlhvtxignmaozy30vfgz   Ready<none>   3m14s   v1.19.4
[root@iZ0jlhvtxignmaozy30vffZ ~]# kubectl get pod -A
NAMESPACE     NAME                                              READY   STATUS    RESTARTS   AGE
kube-system   coredns-6d56c8448f-n7f9k1/1     Running0          20m
kube-system   coredns-6d56c8448f-tz6m41/1     Running0          20m
kube-system   etcd-iz0jlhvtxignmaozy30vffz1/1     Running0          20m
kube-system   kube-apiserver-iz0jlhvtxignmaozy30vffz1/1     Running0          20m
kube-system   kube-controller-manager-iz0jlhvtxignmaozy30vffz1/1     Running0          20m
kube-system   kube-flannel-ds-7j7jn1/1     Running0          9m51s
kube-system   kube-flannel-ds-fdkbv1/1     Running0          9m51s
kube-system   kube-proxy-fdz491/1     Running0          12m
kube-system   kube-proxy-kgzcp1/1     Running0          20m
kube-system   kube-scheduler-iz0jlhvtxignmaozy30vffz1/1     Running0          20m

13.工作负载worker节点(k8s-node01、k8s-node02、k8s-node03 配置admin.conf,实现worker节点 kubectl get …)

# k8s-master01 传文件到k8s-node01、k8s-node02、k8s-node03# 其中172.24.114.4为 k8s-node01 节点scp -r /etc/kubernetes/admin.conf root@172.24.114.4:/etc/kubernetes/# 其中172.24.114.1为  k8s-node02 节点scp -r /etc/kubernetes/admin.conf root@172.24.114.1:/etc/kubernetes/# 其中172.24.114.2为 k8s-node03 节点scp -r /etc/kubernetes/admin.conf root@172.24.114.2:/etc/kubernetes/# 在k8s-node01、k8s-node02、k8s-node03 执行echo"export KUBECONFIG=/etc/kubernetes/admin.conf">> ~/.bash_profilesource ~/.bash_profile

helm3 安装 redis-ha 高可用集群(过程超详细:包含k8s、nfs、storageclass安装步骤)

三、新增work节点

14、请按顺序执行0-9步骤

15、新worker节点添加到集群

#在新worker节点上
kubeadmjoin --token<token>  --discovery-token-ca-cert-hash sha256:<hash>

kubeadm token list#集群创建在24小时以内,获取<token>
或者
kubeadm token create#集群创超过24小时,获取<token>

openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt| openssl rsa -pubin -outform der2>/dev/null|\
   openssl dgst -sha256 -hex|sed's/^.* //'#获取<hash>

16、新节点配置kubectl客户端工具
请执行第13步骤
helm3 安装 redis-ha 高可用集群(过程超详细:包含k8s、nfs、storageclass安装步骤)

四、安装 NFS

主机名 公网 IP 私网 IP
k8s-master01 39.104.173.77 172.24.114.3
k8s-node01 39.104.179.210 172.24.114.4
k8s-node02 39.104.173.12 172.24.114.1
k8s-node03 39.104.177.2 172.24.114.2

4.0、搭建 NFS (选择 k8s-master01 172.24.114.3 )

       server:172.24.114.3 
       path: /data/redis

4.1 在提供 NFS 存储主机上执行,这里默认k8s-master01节点

yuminstall -y nfs-utils#这条命令所有节点master、worker都执行echo"/data/harbor *(insecure,rw,sync,no_root_squash)"> /etc/exports# 执行以下命令,启动 nfs 服务;创建共享目录mkdir -p /data/redis# 在master执行chmod -R777 /data/redis# 使配置生效
exportfs -r#检查配置是否生效
exportfs

systemctlenable rpcbind&& systemctl start rpcbind

systemctlenable nfs&& systemctl start nfs

4.2 在worker主机上执行(k8s-node01 k8s-node02 k8s-node03)

yuminstall -y nfs-utils#这条命令所有节点master、worker都执行

showmount -e172.24.114.3#查看worker节点是否能查到master节点的nfs文件

五、配置 StorageClass 存储

vim redis-storage.yaml
## 创建了一个存储类
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: nfs-storage
  annotations:
    storageclass.kubernetes.io/is-default-class:"true"
provisioner: redis-provisioner#Deployment中spec.template.spec.containers.env.name.PROVISIONER_NAME 保持一致
parameters:
  archiveOnDelete:"true"## 删除pv的时候,pv的内容是否要备份

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nfs-client-provisioner
  labels:
    app: nfs-client-provisioner# replace with namespace where provisioner is deployed
  namespace: default
spec:
  replicas:1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: nfs-client-provisioner
  template:
    metadata:
      labels:
        app: nfs-client-provisioner
    spec:
      serviceAccountName: nfs-client-provisioner
      containers:
        - name: nfs-client-provisioner
          image: registry.cn-hangzhou.aliyuncs.com/lfy_k8s_images/nfs-subdir-external-provisioner:v4.0.2# resources:#    limits:#      cpu: 10m#    requests:#      cpu: 10m
          volumeMounts:
            - name: nfs-client-root
              mountPath: /persistentvolumes
          env:
            - name: PROVISIONER_NAME
              value: redis-provisioner
            - name: NFS_SERVER
              value:172.24.114.3## 指定自己nfs服务器地址
            - name: NFS_PATH  
              value: /data/redis## nfs服务器共享的目录
      volumes:
        - name: nfs-client-root
          nfs:
            server:172.24.114.3
            path: /data/redis
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: nfs-client-provisioner# replace with namespace where provisioner is deployed
  namespace: default
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: nfs-client-provisioner-runner
rules:
  - apiGroups:[""]
    resources:["nodes"]
    verbs:["get","list","watch"]
  - apiGroups:[""]
    resources:["persistentvolumes"]
    verbs:["get","list","watch","create","delete"]
  - apiGroups:[""]
    resources:["persistentvolumeclaims"]
    verbs:["get","list","watch","update"]
  - apiGroups:["storage.k8s.io"]
    resources:["storageclasses"]
    verbs:["get","list","watch"]
  - apiGroups:[""]
    resources:["events"]
    verbs:["create","update","patch"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: run-nfs-client-provisioner
subjects:
  - kind: ServiceAccount
    name: nfs-client-provisioner# replace with namespace where provisioner is deployed
    namespace: default
roleRef:
  kind: ClusterRole
  name: nfs-client-provisioner-runner
  apiGroup: rbac.authorization.k8s.io
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: leader-locking-nfs-client-provisioner# replace with namespace where provisioner is deployed
  namespace: default
rules:
  - apiGroups:[""]
    resources:["endpoints"]
    verbs:["get","list","watch","create","update","patch"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: leader-locking-nfs-client-provisioner# replace with namespace where provisioner is deployed
  namespace: default
subjects:
  - kind: ServiceAccount
    name: nfs-client-provisioner# replace with namespace where provisioner is deployed
    namespace: default
roleRef:
  kind: Role
  name: leader-locking-nfs-client-provisioner
  apiGroup: rbac.authorization.k8s.io
kubectl apply -f redis-storage.yaml

六、安装 helm

6.1 安装包的下载地址:https://github.com/helm/helm/releases
6.2 下载软件包:helm-v3.6.3-linux-amd64.tar.gz,如下二选一

wget https://get.helm.sh/helm-v3.6.3-linux-amd64.tar.gz# curl -L https://get.helm.sh/helm-v3.6.3-linux-amd64.tar.gz -o helm-v3.6.3-linux-amd64.tar.gz

6.3 解压安装包

[root@k8s-master01 ~]# tar -zxvf helm-v3.6.3-linux-amd64.tar.gz[root@k8s-master01~]# cd linux-amd64/[root@k8s-master01 linux-amd64]# ls
 helm  LICENSE  README.md[root@server1 linux-amd64]# cp helm /usr/local/bin/[root@k8s-master01 ~]# helm version
version.BuildInfo{Version:"v3.6.2", GitCommit:"ee407bdf364942bcb8e8c665f82e15aa28009b71", GitTreeState:"clean", GoVersion:"go1.16.5"}

七、helm 安装 redis-ha 高可用 redis 集群

7.1 查找官方helm hub chart库:

[root@k8s-master01 ~]# helm search hub redis
URL                                               	CHART VERSION	APP VERSION     	DESCRIPTION                                       
https://artifacthub.io/packages/helm/choerodon/...16.4.16.2.6           	Redis(TM) is anopen source, advanced key-value...
https://artifacthub.io/packages/helm/wenerme/redis16.8.56.2.6           	Redis(TM) is anopen source, advanced key-value...
https://artifacthub.io/packages/helm/bitnami-ak...16.8.26.2.6           	Redis(TM) is anopen source, advanced key-value...
https://artifacthub.io/packages/helm/wener/redis16.8.56.2.6           	Redis(TM) is anopen source, advanced key-value...
https://artifacthub.io/packages/helm/pascaliske...0.0.36.2.6           	A Helm chartfor Redis                            
https://artifacthub.io/packages/helm/bitnami/redis16.8.56.2.6           	Redis(TM) is anopen source, advanced key-value...
https://artifacthub.io/packages/helm/proto-appl...12.7.76.0.11          	Open source, advanced key-value store. It is of...
https://artifacthub.io/packages/helm/authorizat...12.7.76.0.11          	Open source, advanced key-value store. It is of...
https://artifacthub.io/packages/helm/truecharts...2.0.386.2.6           	Open source, advanced key-value store.            
https://artifacthub.io/packages/helm/cloudnativ...8.0.15.0.5           	Open source, advanced key-value store. It is of...
https://artifacthub.io/packages/helm/drycc-cana...1.0.0        	                	A Redis databasefor use inside a Kubernetes cl...
https://artifacthub.io/packages/helm/riftbit/redis15.4.06.2.5           	Open source, advanced key-value store. It is of...
https://artifacthub.io/packages/helm/taalhuizen...12.7.76.0.11          	Open source, advanced key-value store. It is of...
https://artifacthub.io/packages/helm/jfrog/redis12.10.16.0.12          	Open source, advanced key-value store. It is of...
https://artifacthub.io/packages/helm/mmontes/redis0.1.01.16.0          	Redis with metrics compatible with ARM            
https://artifacthub.io/packages/helm/agendaserv...12.7.76.0.11          	Open source, advanced key-value store. It is of...
https://artifacthub.io/packages/helm/conduction...12.7.76.0.11          	Open source, advanced key-value store. It is of...
https://artifacthub.io/packages/helm/contacten-...12.7.76.0.11          	Open source, advanced key-value store. It is of...
https://artifacthub.io/packages/helm/appuio/redis1.3.46.2.1           	Open source, advanced key-value store. It is of...
https://artifacthub.io/packages/helm/openstack-...0.1.1        	v4.0.1          	OpenStack-Helm Redis                              
https://artifacthub.io/packages/helm/kubesphere...0.3.56.0.9           	Redis is anopensource(BSD licensed), in-memo...
https://artifacthub.io/packages/helm/groundhog2...0.4.116.2.6           	A Helm chartfor Redis on Kubernetes              
https://artifacthub.io/packages/helm/drycc/redis1.2.0        	                	A Redis databasefor use inside a Kubernetes cl...
https://artifacthub.io/packages/helm/notificati...12.7.76.0.11          	Open source, advanced key-value store. It is of...
https://artifacthub.io/packages/helm/redis-char...0.1.0        	v0.2.0          	A Helm chartfor redis-cartservice               
https://artifacthub.io/packages/helm/cloudnativ...0.4.14.0.12-alpine   	A pure in-memory redis cache, using statefulset...
https://artifacthub.io/packages/helm/bitnami/re...7.4.66.2.6           	Redis(TM) is anopen source, scalable, distribu...
https://artifacthub.io/packages/helm/bitnami-ak...7.4.56.2.6           	Redis(TM) is anopen source, scalable, distribu...
https://artifacthub.io/packages/helm/inspur/red...0.0.25.0.6           	Highly available Kubernetes implementation of R...
https://artifacthub.io/packages/helm/kubesphere...3.4.61.3.4           	Prometheus exporterfor Redis metrics             
https://artifacthub.io/packages/helm/dandydev-c...4.15.06.2.5           	This Helm chart provides a highly available Red...
https://artifacthub.io/packages/helm/cloudnativ...3.4.25.0.3           	Highly available Kubernetes implementation of R...
https://artifacthub.io/packages/helm/hkube/redi...3.6.10055.0.5           	Highly available Kubernetes implementation of R...
https://artifacthub.io/packages/helm/kfirfer/re...4.12.96.0.11          	This Helm chart provides a highly available Red...
https://artifacthub.io/packages/helm/aigisuk/re...0.1.81.7.4.2-r0      	A lightweight redis proxy deployment/daemonset...
https://artifacthub.io/packages/helm/softonic/r...0.3.06.0.6           	A Helm chartfor sharded redis                    
https://artifacthub.io/packages/helm/riftbit/re...6.3.76.2.5           	Open source, advanced key-value store. It is of...
https://artifacthub.io/packages/helm/kfirfer/re...0.1.2        	latest          	A Helm chartfor redis-commander                  
https://artifacthub.io/packages/helm/tyk-helm/s...0.1.1        	                	A Simple Helm chartfor running redisfor CI      
https://artifacthub.io/packages/helm/prometheus...4.6.01.27.0          	Prometheus exporterfor Redis metrics             
https://artifacthub.io/packages/helm/wener/prom...4.6.01.27.0          	Prometheus exporterfor Redis metrics             
https://artifacthub.io/packages/helm/cloudnativ...1.0.20.28.0          	Prometheus exporterfor Redis metrics             
https://artifacthub.io/packages/helm/prometheus...4.0.01.11.1          	Prometheus exporterfor Redis metrics             
https://artifacthub.io/packages/helm/wenerme/pr...4.6.01.27.0          	Prometheus exporterfor Redis metrics             
https://artifacthub.io/packages/helm/hmdmph/red...1.0.21.0.0           	Labelling redis pods as master/slave periodical...
https://artifacthub.io/packages/helm/wyrihaximu...1.0.5        	v1.0.1          	Redis Database Assignment Operator                
https://artifacthub.io/packages/helm/appscode/k...2021.10.29   	v0.4.0          	Kubeform Provider Azurerm Redis Custom Resource...
https://artifacthub.io/packages/helm/appscode/k...2021.10.29   	v0.4.0          	Kubeform Provider Google Redis Custom Resource...
https://artifacthub.io/packages/helm/riftbit/re...0.1.0        	v1.0.0          	RedisInsight - The GUIfor Redis                  
https://artifacthub.io/packages/helm/enapter/keydb0.34.06.2.2           	A Helm chartfor KeyDB multimaster setup          
https://artifacthub.io/packages/helm/pozetron/k...0.5.3        	v6.0.16         	A Helm chartfor multimaster KeyDB optionally w...
https://artifacthub.io/packages/helm/riftbit/lo...2.5.1        	v2.1.0          	Loki: like Prometheus, butfor logs.              
https://artifacthub.io/packages/helm/ananace-ch...4.1.03.1.0           	An IP address management(IPAM) and data center...
https://artifacthub.io/packages/helm/oauth2-pro...6.2.07.2.0           	A reverse proxy that provides authentication wi...
https://artifacthub.io/packages/helm/sossickd/p...0.1.05.0.0           	A Helm chartfor the php guest book.              
https://artifacthub.io/packages/helm/camptocamp...3.0.1        	                	A Helm chartfor the Spotahome Redis Operator     
https://artifacthub.io/packages/helm/ectobit/rs...0.8.133.1-alpine3.15.3	Rspamd Helm chartfor Kubernetes                  
https://artifacthub.io/packages/helm/spring-res...0.1.01.16.0          	A SpringBoot Helm chartfor Kubernetes[root@k8s-master01 ~]# helm search hub redis|grep -i stable[root@k8s-master01 ~]#

7.2 Helm 添加第三方 Chart 库:

[root@k8s-master01 ~]# helm repo add stable http://mirror.azure.cn/kubernetes/charts/"stable" already exists with the same configuration, skipping[root@k8s-master01 ~]# helm repo list
NAME    	URL                                      
bitnami 	https://charts.bitnami.com/bitnami       
dandydev	https://dandydeveloper.github.io/charts  
stable  	http://mirror.azure.cn/kubernetes/charts/

7.3 添加第三库之后就可以使用以下方式查询:

[root@k8s-master01 ~]# helm search repo redis
NAME                            	CHART VERSION	APP VERSION	DESCRIPTION                                       
bitnami/redis16.8.56.2.6      	Redis(TM) is anopen source, advanced key-value...
bitnami/redis-cluster7.4.66.2.6      	Redis(TM) is anopen source, scalable, distribu...
dandydev/redis-ha4.15.06.2.5      	This Helm chart provides a highly available Red...
stable/prometheus-redis-exporter3.5.11.3.4      	DEPRECATED Prometheus exporterfor Redis metrics  
stable/redis10.5.75.0.7      	DEPRECATED Open source, advanced key-value stor...
stable/redis-ha4.4.65.0.6      	DEPRECATED - Highly available Kubernetes implem...
stable/sensu0.2.50.28       	DEPRECATED Sensu monitoring framework backed by...

7.4 拉取并修改 redis-ha 安装包

  • 拉取 redis-ha 安装包,到本地
[root@k8s-master01 linux-amd64]# helm pull stable/redis-ha[root@k8s-master01 linux-amd64]# ll
total44088
-rwxr-xr-x1 root root45109248 Apr1913:10 helm
-rw-r--r--13434343411373 Jun292021 LICENSE
-rw-r--r--1343434343367 Jun292021 README.md
-rw-r--r--1 root root17546 Apr1913:10 redis-ha-4.4.6.tgz
  • 解压 redis-ha 安装包
[root@k8s-master01 linux-amd64]# tar -xvf redis-ha-4.4.6.tgz
redis-ha/Chart.yaml
redis-ha/values.yaml
redis-ha/templates/NOTES.txt
redis-ha/templates/_configs.tpl
redis-ha/templates/_helpers.tpl
redis-ha/templates/redis-auth-secret.yaml
redis-ha/templates/redis-ha-announce-service.yaml
redis-ha/templates/redis-ha-configmap.yaml
redis-ha/templates/redis-ha-exporter-script-configmap.yaml
redis-ha/templates/redis-ha-pdb.yaml
redis-ha/templates/redis-ha-role.yaml
redis-ha/templates/redis-ha-rolebinding.yaml
redis-ha/templates/redis-ha-service.yaml
redis-ha/templates/redis-ha-serviceaccount.yaml
redis-ha/templates/redis-ha-servicemonitor.yaml
redis-ha/templates/redis-ha-statefulset.yaml
redis-ha/templates/redis-haproxy-deployment.yaml
redis-ha/templates/redis-haproxy-service.yaml
redis-ha/templates/redis-haproxy-serviceaccount.yaml
redis-ha/templates/redis-haproxy-servicemonitor.yaml
redis-ha/templates/tests/test-redis-ha-configmap.yaml
redis-ha/templates/tests/test-redis-ha-pod.yaml
redis-ha/README.md
redis-ha/ci/haproxy-enabled-values.yaml
  • 进入 redis-ha 安装包
[root@k8s-master01 linux-amd64]# ll
total44092
-rwxr-xr-x1 root root45109248 Apr1913:10 helm
-rw-r--r--13434343411373 Jun292021 LICENSE
-rw-r--r--1343434343367 Jun292021 README.md
drwxr-xr-x4 root root4096 Apr1913:11 redis-ha
-rw-r--r--1 root root17546 Apr1913:10 redis-ha-4.4.6.tgz[root@k8s-master01 linux-amd64]# cd redis-ha[root@k8s-master01 redis-ha]# ll
total64
-rwxr-xr-x1 root root507 Nov142020 Chart.yaml
drwxr-xr-x2 root root4096 Apr1913:11 ci
-rwxr-xr-x1 root root38240 Nov142020 README.md
drwxr-xr-x3 root root4096 Apr1913:11 templates
-rwxr-xr-x1 root root11632 Nov142020 values.yaml[root@k8s-master01 redis-ha]#

上述文件中README.md 为帮助文档,目录templates中为模板部署文件,部署文件中的变量都保存在values.yaml文件中,在部署应用时只需要更改values.yaml文件即可

  • 查看 redis-ha 安装包的目录结构
yuminstall -y tree[root@k8s-master01 redis-ha]# tree ..
├── Chart.yaml
├── ci
│   └── haproxy-enabled-values.yaml
├── README.md
├── templates
│   ├── _configs.tpl
│   ├── _helpers.tpl
│   ├── NOTES.txt
│   ├
  • 作者:黑科技王子
  • 原文链接:https://blog.csdn.net/zhiboqingyun/article/details/124266923
    更新时间:2022年6月9日09:08:33 ,共 22944 字。