微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

我的 Clair pod 定期重启

如何解决我的 Clair pod 定期重启

我在我的港口使用 Clair 进行漏洞检查。

像 Clair 这样有数千台主机不断访问托管 git 服务器 (https://git.launchpad.net/ubuntu-cve-tracker/) 的服务使服务器饱和,因此有一些扩展措施会导致它在并发太多客户端时返回 503 错误击中它。

这些是我在 Clair pod 中的错误

{"Event":"Could not pull ubuntu-cve-tracker repository","Level":"error","Location":"ubuntu.go:174","Time":"2021-06-25 06:38:32.859806","error":"exit status 128","output":"cloning into '.'...

fatal: unable to access '[https://git.launchpad.net/ubuntu-cve-tracker/':|https://git.launchpad.net/ubuntu-cve-tracker/%27:] 
The requested URL returned error: 503\n"} 

{"Event":"an error occured when fetching update","Location":"updater.go:246","Time":"2021-06-25 06:38:32.859934","error":"Could not download requested resource","updater name":"ubuntu"}
panic: runtime error: slice bounds out of range goroutine 549 [running]: github.com/coreos/clair/ext/vulnsrc/rhel.toFeatureversions(0xc000208390,0x2,0xc000246070,0x1,0xc0001bc200,0x0,0x908f38,...) /go/src/github.com/coreos/clair/ext/vulnsrc/rhel/rhel.go:292 +0xc3b github.com/coreos/clair/ext/vulnsrc/rhel.parseRHSA(0x7fcc0f4a24b0,0xc00038c0f0,0x7fcc0f4a24b0,0x8e2708,0x4) /go/src/github.com/coreos/clair/ext/vulnsrc/rhel/rhel.go:182 +0x1c8 

根据 https://bugs.launchpad.net/ubuntu-cve-tracker/+bug/1925337,这是来自 git 服务器的错误,在该帖子中,他们建议让 Clair 从其他来源提取数据,而不是使用离线方法。那么除了离线方式之外,还有没有其他方法可以减少git服务器漏洞检查的命中次数

我试图控制对 git 服务器的点击次数,但在 Clair 中找不到配置。

有谁知道我们如何控制漏洞检查的命中或避免我的 pod 重新启动?

此外,我发现在我的 Harbor UI 上安排扫描(每小时、每天或每周),但是如何安排扫描以显示每日帮助?
是否只有在那时它才会尝试执行 git clone 以获取最新的 CVE?

解决方法

首先检查这是否与 goharbor/harbor issue 14720 相关联:“当漏洞存储库出现问题时,clair 会反复重启”,日志类似

{"Event":"Start fetching vulnerabilities","Level":"info","Location":"ubuntu.go:85","Time":"2021-04-21 19:18:24.446743","package":"Ubuntu"}
...
{"Event":"could not pull ubuntu-cve-tracker repository","Level":"error","Location":"ubuntu.go:174","Time":"2021-04-21 19:18:25.147515","error":"exit status 128","output":"Cloning into '.'...\nfatal: unable to access 'https://git.launchpad.net/ubuntu-cve-tracker/': The requested URL returned error: 503\n"}
{"Event":"an error occured when fetching update","Location":"updater.go:246","Time":"2021-04-21 19:18:25.147607","error":"could not download requested resource","updater name":"ubuntu"}
...
panic: runtime error: slice bounds out of range [25:24]

goroutine 327 [running]:
github.com/quay/clair/v2/ext/vulnsrc/rhel.toFeatureVersions(0xc0065215a8,0x2,0xc0000b4f08,0x1,0xc006ef7aa0,0xc0000b4ef0,...)
    /go/src/github.com/quay/clair/ext/vulnsrc/rhel/rhel.go:276 +0xbf8

它指的是quay/clair issue 1249,但港口案例以PR 15032结束,使用CLAIRVERSION=v2.1.7

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。