新聞中心
Harbor簡介
Harbor是一個開源的企業(yè)級容器注冊中心,用于存儲和分發(fā)Docker鏡像,它提供了一個簡單易用的Web界面,方便用戶管理和操作容器鏡像,Kubernetes(簡稱K8s)是一個開源的容器編排系統(tǒng),可以自動化地部署、擴展和管理容器化應用程序,Helm是Kubernetes的一個包管理工具,可以幫助用戶更方便地安裝和管理Kubernetes應用,本文將介紹如何在Kubernetes Helm中安裝和使用Harbor。

公司主營業(yè)務:成都做網站、成都網站建設、移動網站開發(fā)等業(yè)務。幫助企業(yè)客戶真正實現(xiàn)互聯(lián)網宣傳,提高企業(yè)的競爭能力。創(chuàng)新互聯(lián)是一支青春激揚、勤奮敬業(yè)、活力青春激揚、勤奮敬業(yè)、活力澎湃、和諧高效的團隊。公司秉承以“開放、自由、嚴謹、自律”為核心的企業(yè)文化,感謝他們對我們的高要求,感謝他們從不同領域給我們帶來的挑戰(zhàn),讓我們激情的團隊有機會用頭腦與智慧不斷的給客戶帶來驚喜。創(chuàng)新互聯(lián)推出邗江免費做網站回饋大家。
安裝Harbor
1、準備環(huán)境
在安裝Harbor之前,需要確保已經安裝了Kubernetes集群和Helm,還需要配置好kubectl命令行工具,以便與Kubernetes集群進行交互。
2、下載Harbor安裝包
從Harbor的GitHub倉庫下載最新版本的Harbor安裝包:https://github.com/goharbor/harbor/releases
3、解壓安裝包
將下載的安裝包解壓到一個目錄中,/opt/harbor
tar -zxvf harbor-offline-installer-vx.y.z.tgz -C /opt/harbor
4、修改配置文件
進入解壓后的目錄,編輯harbor.yml文件,設置相關參數,主要需要修改以下幾個參數:
hostname:設置Harbor的域名或IP地址;
http:設置Harbor的HTTP端口;
https:設置Harbor的HTTPS端口;
data_volume:設置Harbor的數據持久化存儲路徑;
expose:設置Harbor的訪問端口。
hostname: your_domain_or_ip http: port: 80 https: port: 443 expose: 80 443 data_volume: /path/to/your/data_volume
5、安裝Harbor
運行以下命令開始安裝Harbor:
./install.sh --with-notary --with-trivy --with-clair --with-regulatory --with-selfsigned-certs --with-persistence=redis --with-mqtt=disabled --with-syslog --with-insecure-registry=true --with-pachd=false --with-graphql=false --with-replication=none --with-backup=none --with-storagedriver=nullstore --with-dbauth=true --with-ldapauth=true --with-tokenauth=true --with-cosiauth=false --with-jwtauth=false --with-redisauth=false --with-mysqlauth=false --with-postgresauth=false --with-sqlaauth=false --with-approleauth=false --with-keycloakauth=false --with-kubernetesauth=true --with-traefik=false --with-nodeport=true --with-cleanup=false --with-allowadmin="true" --set="global.registry='your_registry_host'" | sudo tee /etc/yum.repos.d/harbor.repo && sudo yum install -y harbor && sudo systemctl enable and start harbor && sudo systemctl status harbor && sudo docker run -d -p 80:80 -p 443:443 --name harbor registry:2 || true && sudo docker login your_registry_host && sudo docker pull your_registry_host/library/harbor && sudo docker tag your_registry_host/library/harbor your_domain_or_ip/harbor && sudo docker push your_domain_or_ip/harbor && sudo docker ps | grep harbor || true && sudo docker logs harbor || true"
根據提示完成輸入即可,安裝完成后,可以通過瀏覽器訪問http://your_domain_or_ip進入Harbor的管理界面。
在Kubernetes中部署Harbor
1、創(chuàng)建命名空間
在Kubernetes中,所有的資源都需要在一個命名空間中,可以使用以下命令創(chuàng)建一個名為harbor的命名空間:
kubectl create namespace harbor
2、編寫部署文件
創(chuàng)建一個名為harbor-deployment.yaml的文件,內容如下:
apiVersion: apps/v1
kind: Deployment
metadata:
name: harbor
spec:
replicas: 1
selector:
matchLabels:
app: harbor
template:
metadata:
labels:
app: harbor
spec:
containers:
name: harbor
image: harbor:latest
ports:
containerPort: 8080
envFrom:
configMapRef:
name: harbor-configmap
apiVersion: v1
kind: ServiceAccount
metadata:
name: harbor-serviceaccount
namespace: harbor
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: harbor-adminuserrolebinding
subjects: []
roleRef:
kind: ClusterRole
name: cluster-admin
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: harbor-adminuserrolebinding2022011917265596939000236796965697593975967596759675967596759675967596759675967596759675967596759675967596759675967596759675967596759675967596759675967596759675967596759675967596759675967596759675967596759675967596759675967596759675967596759675967596759675967596759675967596759675967596759675938234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234234 == harbor@harbor && serviceaccount:default: + envValue + = true && serviceaccount_name != harbor && serviceaccount_uid != harbor && path != /* && path != */ + user && path != /* + group && path != */ + privileged + * => *,subjects: [{ kind: ServiceAccountKind, name: "harbor", namespace: "harbor"}],rules=[{ apiGroups: [""], resources: ["events"], verbs: ["create"]},{ apiGroups: [""], resources: ["nodes"], verbs: ["create"]},{ apiGroups: [""], resources: ["pods"], verbs: ["get", "watch", "list", "update", "patch", "delete"], verbsIgnoreUnknownParams: true},{ apiGroups: ["extensions"], resources: ["replicasets"], verbs: ["get", "list", "watch", "create", "update", "patch", "delete"], verbsIgnoreUnknownParams: true},{ apiGroups: [""], resources: ["serviceaccounts"], verbs: ["get", "list", "watch", "create", "update", "patch", "delete"], verbsIgnoreUnknownParams: true},{ apiGroups: [""], resources: + envValue + , verbs: + envValue + ={read=true},verbsIgnoreUnknownParams: true}],kinds=[ClusterRole],metadata: {},scope":"Namespaced") > harbor-adminuserrolebinding.yaml && kubectl apply -f harbor-adminuser
文章題目:helmkubernetes部署
網站網址:http://m.5511xx.com/article/coidhoe.html


咨詢
建站咨詢
