查看当前磁盘使用率

harbor 垃圾清理
harbor 执行垃圾清理释放磁盘空间

harbor 垃圾清理报错

查看 nginx 配置
worker_processes auto;
events {
worker_connections 1024;
use epoll;
multi_accept on;
}
http {
tcp_nodelay on;
# this is necessary for us to be able to disable request buffering in all cases
proxy_http_version 1.1;
upstream core {
server core:8080;
}
upstream portal {
server portal:80;
}
log_format timed_combined '$remote_addr - '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" '
'$request_time $upstream_response_time $pipe';
access_log /dev/stdout timed_combined;
server {
listen 80;
server_tokens off;
# disable any limits to avoid HTTP 413 for large image uploads
client_max_body_size 0;
# costumized location config file can place to /etc/nginx/etc with prefix harbor.http. and suffix .conf
include /etc/nginx/conf.d/harbor.http.*.conf;
location / {
proxy_pass http://portal/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings.
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_request_buffering off;
}
location /c/ {
proxy_pass http://core/c/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings.
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_request_buffering off;
}
location /api/ {
proxy_pass http://core/api/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings.
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_request_buffering off;
}
location /chartrepo/ {
proxy_pass http://core/chartrepo/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings.
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_request_buffering off;
}
location /v1/ {
return 404;
}
location /v2/ {
proxy_pass http://core/v2/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings.
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_request_buffering off;
}
location /service/ {
proxy_pass http://core/service/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings.
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_request_buffering off;
}
location /service/notifications {
return 404;
}
}
}
查看 core 日志
docker logs --tail 10 -f harbor-core
2025-01-07T06:06:32Z [ERROR] [/common/api/base.go:200]: failed to submit admin job: Post http://jobservice:8080/api/v1/jobs: dial tcp: lookup jobservice on 127.0.0.11:53: read udp 127.0.0.1:43821->127.0.0.11:53: i/o timeout
2025-01-07T06:06:32Z [ERROR] [/common/api/base.go:233]:
2025-01-07T06:06:32Z [ERROR] [/common/api/base.go:73]: POST /api/system/gc/schedule failed with error: {"code":500,"message":"Internal Server Error"}
2025/01/07 06:06:32 [D] [server.go:2619] | 172.18.0.1| 500 | 3.995072691s| match| POST /api/system/gc/schedule r:/api/system/gc/schedule
2025/01/07 06:06:42 [D] [server.go:2619] | 172.18.0.1| 401 | 5.141313ms| match| GET /v2/ r:/v2/*
jobservice 状态
查看 jobserver id
docker ps | grep jobservice
898b772a992d goharbor/harbor-jobservice:v1.8.6 "/harbor/start.sh" 18 months ago Up 14 minutes harbor-jobservice
登录 jobserver
docker exec -ti 898b772a992d bash
Error response from daemon: Container 898b772a992dcd2f3783ec04992d37102df326ab0ec102d580998e3602a96f22 is not running
重启 jobserver
docker restart 898b772a992d
执行 harbor 垃圾清理

验证磁盘使用率

总结
因 jobservice 服务异常导致 垃圾回收任务失败。