1. Installation
(1) View: https://github.com/helm/helm/releases
(2) Download: wget https://get.helm.sh/helm-v3.5.2-linux-amd64.tar.gz (Blue Music Cloud: https://wws.lanzous.com/iK386mqjfif )
(3) Unzip and copy the executable file to the system directory
tar -zxvf helm-v3.5.2-linux-amd64.tar.gz
cp linux-amd64/helm /usr/local/bin/
Two, use
1. Warehouse
(1) View: helm repo list
(2) Add: helm repo add, referred to as the warehouse path
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add harbor https://helm.goharbor.io
helm repo add stable https://charts.helm.sh/stable
2. Application
- Take harbor as an example (required resources: https://download.csdn.net/download/u013595395/15767709 )
(1) Find: helm search repo harbor
(2) Use:
1. Download the configuration file
helm show values harbor/harbor > all-conf.yml
2. Download the software package
helm pull harbor/harbor
3. Installation
helm install harbor harbor/harbor
或 helm install harbor ./harbor-1.6.0.tgz
或 tar -zxvf harbor-1.6.0.tgz 再 helm install harbor ./harbor
helm install harbor ./harbor-1.6.0.tgz -f ./conf-1.yml -n a-env
-f: Specify the configuration file used
-n: Specify the installed Namespace
# conf-1.yml
expose:
type: nodePort
tls:
enabled: false
nodePort:
ports:
http:
port: 80
nodePort: 30002
harborAdminPassword: "admin"
externalURL: http://192.168.15.135:30002
persistence:
enabled: false
- Access address: http://192.168.102.129:30002 admin/admin
4. View the current status
helm status redis -n a1-service
5. Upgrade the application with the new configuration
helm upgrade harbor ./harbor-1.6.0.tgz -f ./conf-2.yml -n a-env
6. Find release and uninstall
helm list -n a-env 或 helm list -A
helm uninstall harbor -n a-env
7. View historical version and roll back
helm history harbor -n a-env
helm rollback harbor 1 -n a-env
3. Other documents
http://www.mydlq.club/article/51
http://docs.minio.org.cn/docs/master/deploy-minio-on-kubernetes
Other harbor configuration:
1. Use nfs to store volumes
(1) Create pv and pvc
vi pv-pvc.yml
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: a-soft-harbor-data
labels:
name: a-soft-harbor-data
spec:
# storageClassName:
accessModes:
- ReadWriteOnce
- ReadWriteMany
capacity:
storage: 20Gi
persistentVolumeReclaimPolicy: Retain #其他:Recycle、Delete
nfs:
server: 192.168.15.135
path: /a_soft/harbor/data
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: a-soft-harbor-data
namespace: a-env
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 20Gi
selector:
matchLabels:
name: a-soft-harbor-data
kubectl apply -f pv-pvc.yml
(2) Pay attention to the permissions of the folders in nfs
chmod -R 777 /a_soft/harbor/data
(3) Modify the harbor configuration file
vi conf-2.yml
expose:
type: nodePort
tls:
enabled: false
nodePort:
name: harbor
ports:
http:
port: 80
nodePort: 30002
externalURL: http://192.168.102.129:30002
harborAdminPassword: "admin"
persistence:
enabled: true
resourcePolicy: "keep"
persistentVolumeClaim:
registry:
existingClaim: "a-soft-harbor-data"
storageClass: "-"
subPath: "registry"
accessMode: ReadWriteMany
size: 5Gi
chartmuseum:
existingClaim: "a-soft-harbor-data"
storageClass: "-"
subPath: "chartmuseum"
accessMode: ReadWriteMany
size: 5Gi
jobservice:
existingClaim: "a-soft-harbor-data"
storageClass: "-"
subPath: "jobservice"
accessMode: ReadWriteMany
size: 1Gi
database:
existingClaim: "a-soft-harbor-data"
storageClass: "-"
subPath: "database"
accessMode: ReadWriteMany
size: 1Gi
redis:
existingClaim: "a-soft-harbor-data"
storageClass: "-"
subPath: "redis"
accessMode: ReadWriteMany
size: 1Gi
trivy:
existingClaim: "a-soft-harbor-data"
storageClass: "-"
subPath: "trivy"
accessMode: ReadWriteMany
size: 5Gi
helm upgrade harbor ./harbor-1.6.0.tgz -f ./conf-2.yml -n a-env
2. Add certificate to enable tls
(1) Create a certificate
https://blog.csdn.net/u013595395/article/details/114279877
(2) Generate secret by certificate
kubectl create secret generic tls -n a-env --from-file=tls.crt=./server.crt --from-file=tls.key=./server.key --from-file=ca.crt=./ca.crt --from-file=ca.key=./ca.key
(3) Modify the harbor configuration
expose:
type: nodePort
tls:
enabled: true
certSource: secret
secret:
secretName: "tls"
nodePort:
name: harbor
ports:
http:
port: 80
nodePort: 30002
https:
port: 443
nodePort: 30003
externalURL: https://192.168.15.135:30003
harborAdminPassword: "admin"
persistence:
enabled: true
resourcePolicy: "keep"
persistentVolumeClaim:
registry:
existingClaim: "a-soft-harbor-data"
storageClass: "-"
subPath: "registry"
accessMode: ReadWriteMany
size: 5Gi
chartmuseum:
existingClaim: "a-soft-harbor-data"
storageClass: "-"
subPath: "chartmuseum"
accessMode: ReadWriteMany
size: 5Gi
jobservice:
existingClaim: "a-soft-harbor-data"
storageClass: "-"
subPath: "jobservice"
accessMode: ReadWriteMany
size: 1Gi
database:
existingClaim: "a-soft-harbor-data"
storageClass: "-"
subPath: "database"
accessMode: ReadWriteMany
size: 1Gi
redis:
existingClaim: "a-soft-harbor-data"
storageClass: "-"
subPath: "redis"
accessMode: ReadWriteMany
size: 1Gi
trivy:
existingClaim: "a-soft-harbor-data"
storageClass: "-"
subPath: "trivy"
accessMode: ReadWriteMany
size: 5Gi
helm upgrade harbor ./harbor-1.6.0.tgz -f ./conf-3.yml -n a-env
(4) Test
docker login -u admin -p admin 192.168.15.135:30003
docker tag busybox 192.168.15.135:30003/library/busybox:1.0
docker push 192.168.15.135:30003/library/busybox:1.0
- Note: Put the CA certificate in the following directory without restarting docker
mkdir -p /etc/docker/certs.d/192.168.15.135\:30003
Catalog: https://blog.csdn.net/u013595395/article/details/114527658