Helm 是 Kubernetes 的包管理器,包管理器类似于我们在 Ubuntu 中使用的apt、Centos中使用的yum一样,能快速查找、下载和安装软件包,本篇文章探索编写openGauss的 Helm Chart的包,方便openGauss的在Kubernetes的快速部署.
1.环境清单
#检查k8s运行环境
[root@n-k8s-m ~]# kubectl get node
```
NAME STATUS ROLES AGE VERSION
n-k8s-m Ready master 349d v1.18.0
```
#检查Helm运行环境
[root@n-k8s-m ~]# helm version
```
version.BuildInfo{Version:"v3.6.0", GitCommit:"7f2df6467771a75f5646b7f12afb408590ed1755", GitTreeState:"clean", GoVersion:"go1.16.3"}
```
#查看存储类
[root@n-k8s-m ~]#kubectl get sc
```
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
managed-nfs-storage fuseim.pri/ifs Delete Immediate false 157m
```
2.创建openGauss的包管理模板
[root@n-k8s-m helm]# helm create opengauss
```
Creating opengauss
```
3.查看包管理模板
[root@n-k8s-m helm]# tree opengauss
```
opengauss
├── charts
├── Chart.yaml
├── templates
│ ├── deployment.yaml
│ ├── _helpers.tpl
│ ├── hpa.yaml
│ ├── ingress.yaml
│ ├── NOTES.txt
│ ├── pvc.yaml
│ ├── serviceaccount.yaml
│ ├── service.yaml
│ └── tests
│ └── test-connection.yaml
└── values.yaml
```
4.编写变量文件values.yaml
[root@n-k8s-m helm]#cat values.yaml
```
# Default values for opengauss.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: opengauss
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "2.0.0"
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
## Specify password for root user#
## Default: random 10 character string
RootPassword: Gauss@123
## Persist data to a persistent volume
persistence:
enabled: true
## database data Persistent Volume Storage Class
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is
## set, choosing the default provisioner. (gp2 on AWS, standard on
## GKE, AWS & OpenStack)
##
storageClass: "managed-nfs-storage"
accessMode: ReadWriteOnce
size: 4Gi
annotations: {}
serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
#