# The IP address or hostname to access admin UI and registry service. # DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients. hostname: 192.168.10.250
# http related config http: # port for http, default is 80. If https enabled, this port will redirect to https port port: 80
# https related config # https: # https port for harbor, default is 443 # port: 443 # The path of cert and key files for nginx # certificate: /root/harbor/6864844_kubemsb.com.pem # private_key: /root/harbor/6864844_kubemsb.com.key
# # Uncomment following will enable tls communication between all harbor components # internal_tls: # # set enabled to true means internal tls is enabled # enabled: true # # put your cert and key files on dir # dir: /etc/harbor/tls/internal
# Uncomment external_url if you want to enable external proxy # And when it enabled the hostname will no longer used # external_url: https://reg.mydomain.com:8433
# The initial password of Harbor admin # It only works in first time to install harbor # Remember Change the admin password from UI after launching Harbor. harbor_admin_password: 12345 访问密码 ......
[Step4]: preparing harbor configs ... prepare base dir is set to /root/harbor
[Step5]: starting Harbor ... Creating network "harbor_harbor" with the default driver Creating harbor-log ... done Creating harbor-db ... done Creating registry ... done Creating registryctl ... done Creating redis ... done Creating harbor-portal ... done Creating harbor-core ... done Creating harbor-jobservice ... done Creating nginx ... done ✔ ----Harbor has been installed and started successfully.----
1.1.7 验证运行情况
1 2 3 4 5 6 7 8 9 10 11 12
# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 71c0db683e4a goharbor/nginx-photon:v2.5.1"nginx -g 'daemon of…" About a minute ago Up About a minute (healthy) 0.0.0.0:80->8080/tcp, :::80->8080/tcp, 0.0.0.0:443->8443/tcp, :::443->8443/tcp nginx 4e3b53a86f01 goharbor/harbor-jobservice:v2.5.1"/harbor/entrypoint.…" About a minute ago Up About a minute (healthy) harbor-jobservice df76e1eabbf7 goharbor/harbor-core:v2.5.1"/harbor/entrypoint.…" About a minute ago Up About a minute (healthy) harbor-core eeb4d224dfc4 goharbor/harbor-portal:v2.5.1"nginx -g 'daemon of…" About a minute ago Up About a minute (healthy) harbor-portal 70e162c38b59 goharbor/redis-photon:v2.5.1"redis-server /etc/r…" About a minute ago Up About a minute (healthy) redis 8bcc0e9b06ec goharbor/harbor-registryctl:v2.5.1"/home/harbor/start.…" About a minute ago Up About a minute (healthy) registryctl d88196398df7 goharbor/registry-photon:v2.5.1"/home/harbor/entryp…" About a minute ago Up About a minute (healthy) registry ed5ba2ba9c82 goharbor/harbor-db:v2.5.1"/docker-entrypoint.…" About a minute ago Up About a minute (healthy) harbor-db dcb4b57c7542 goharbor/harbor-log:v2.5.1"/bin/sh -c /usr/loc…" About a minute ago Up About a minute (healthy) 127.0.0.1:1514->10514/tcp harbor-log
[root@harbor ~]# docker login 192.168.10.250 Username: admin Password: 这里密码是12345 WARNING! Your password will be stored unencrypted in /root/.docker/config.json. Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-store
[root@harbor ~]# docker tag nginx:1.15-alpine 192.168.10.250/test/nginx:v1
[root@k8s-master1 ~]# kubectl apply -f pod-harbor.yml pod/pod-harbor created
2.1.6 验证pod
1 2 3 4 5 6 7 8 9 10 11
[root@k8s-master1 ~]# kubectl describe pod pod-harbor Events: Type Reason Age From Message ------------------------- Normal Scheduled 16s default-scheduler Successfully assigned default/pod-harbor to k8s-worker1 Normal Pulling 15s kubelet Pulling image "192.168.10.250/test/nginx:v1" Normal Pulled 14s kubelet Successfully pulled image "192.168.10.250/test/nginx:v1"in630.869309ms Normal Created 14s kubelet Created container c1 Normal Started 14s kubelet Started container c1
[root@k8s-master1 ~]# kubectl delete pod pod-harbor pod "pod-harbor" deleted
[root@k8s-master1 ~]# kubectl apply -f pod-harbor.yml pod/pod-harbor created
[root@k8s-master1 ~]# kubectl get pods NAME READY STATUS RESTARTS AGE pod-harbor1/1 Running 08s
1 2 3 4 5 6 7 8 9
[root@k8s-master1 ~]# kubectl describe pods pod-harbor Events: Type Reason Age From Message ------------------------- Normal Scheduled 13s default-scheduler Successfully assigned default/pod-harbor to k8s-worker2 Normal Pulling 13s kubelet Pulling image "192.168.10.250/test/nginx:v1" Normal Pulled 12s kubelet Successfully pulled image "192.168.10.250/test/nginx:v1"in731.788686ms Normal Created 12s kubelet Created container c1 Normal Started 12s kubelet Started container c1