iT邦幫忙

0

k8s bug錯誤:http: server gave HTTP response to HTTPS c lient and Unknown key "keyPaths"

  • 分享至 

  • xImage
  •  

錯誤訊息

Failed to pull image "192.168.1.12:30004/dev/platform:latest": rpc error: code = Unknown desc = pinging container registry 192.168.1.12:30004: Get "https://192.168.1.12:30004/v2/": http: server gave HTTP response to HTTPS c lient

環境:kubernetes版本:1.22
私倉:harbor
底層作業系統:rhel 8.5

解決思路

1.查到網路資料偏向docker insecure-registries設定,因此在朝向是否安裝docker在本機端,但安裝docker會影響到crio設定或者版本,因此選擇安裝podman
2.安裝完podman並設定podman的insecure-registries,(docker與podman安裝insecure-registries不一樣)
3.安裝完後測試pull imagesg是否正常
4.再次部屬前後端,依然發生問題Unknown key "keyPaths"問題,使用修正補丁
5.重新佈署可以正常了

1.安裝podman

sudo yum module enable -y container-tools:rhel8
sudo yum module install -y container-tools:rhel8

https://podman.io/getting-started/installation

2.安裝完podman並設定podman的insecure-registries

https://ithelp.ithome.com.tw/upload/images/20230131/20154176RhFQkAytQz.png

sudo vim /etc/containers/registries.conf
[[registry]]
insecure = true
location = "192.168.1.12:30004"

$ sudo systemctl restart podman
$ podman info

https://williamlieurance.com/insecure-podman-registry/

3.安裝完後測試pull imagesg是否正常

pod設定完後再次重啟部屬,發現新問題錯誤無如下

Failed to pull image "192.168.1.12:30004/dev/platform:latest": rpc error: code = Unknown desc = invalid policy in "/etc/containers/policy.json": Unknown key "keyPaths"

https://ithelp.ithome.com.tw/upload/images/20230131/20154176qsxoautEh3.png

4.修正發生問題Unknown key "keyPaths"問題

$ sudo podman image trust set -f /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release registry.access.redhat.com
$ sudo podman image trust set -f /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release registry.redhat.io
$ cat <<EOF > /etc/containers/registries.d/registry.access.redhat.com.yaml
docker:
     registry.access.redhat.com:
         sigstore: https://access.redhat.com/webassets/docker/content/sigstore
EOF

> cat <<EOF > /etc/containers/registries.d/registry.redhat.io.yaml
docker:
     registry.redhat.io:
         sigstore: https://registry.redhat.io/containers/sigstore
EOF

https://github.com/cri-o/cri-o/issues/6197

5.重新佈署可以正常了

https://ithelp.ithome.com.tw/upload/images/20230131/20154176ENtmzxmXzT.png


圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言