--- title: Tanzu Kubernetes Grid 1.2.1 (K8s 1.19.3, Containerd 1.4.1)でコンテナイメージのlabelサイズが4KB以上の場合にpullできない問題のworkaroundメモ tags: ["Kubernetes", "TKG", "Tanzu", "ytt"] categories: ["Dev", "CaaS", "Kubernetes", "TKG"] date: 2021-02-24T16:16:07Z updated: 2021-03-29T06:45:12Z --- > TKG 1.3では対応不要です。 TKG 1.2.1でK8s 1.19.3(Containerd 1.4.1)でコンテナイメージをpullする際にラベルのサイズが大きい(4KB以上)場合に次のエラーが発生し、`Failed to pull image`になります。 ``` info.Labels: label key and value greater than maximum size (4096 bytes), key: containerd: invalid argument ``` > TKG 1.2.1でもK8s 1.19.1(Containerd 1.3.4)の場合はこの問題は発生しません。 自分は[Tanzu Build Service](https://network.pivotal.io/products/build-service)をインストールする際にこの問題に遭遇しました。 この問題は[Containerd 1.4.2](https://github.com/containerd/containerd/releases/tag/v1.4.2)でFixされているので、次のバージョンでは直っていると思います。 Workaroundとしては**全ての**Node上の`/etc/containerd/config.toml`に ``` [plugins."io.containerd.grpc.v1.cri".containerd]' disable_snapshot_annotations = true ``` を追加し、containerdを再起動すればこの問題を回避できます。 既に作成済みのクラスタに関しては以下の作業を全てのNodeに対して行う必要があります。 ``` ssh capv@ -i sudo su - echo ' [plugins."io.containerd.grpc.v1.cri".containerd]' >> /etc/containerd/config.toml echo ' disable_snapshot_annotations = true' >> /etc/containerd/config.toml systemctl restart containerd ``` 新規のクラスタに関してはこのWorkaroundを適用済みの状態で作成されるようにするためには、`~/.tkg/providers/infrastructure-vsphere/ytt/vsphere-overlay.yaml`に次のytt overlayを書けば良いです。 ```yaml #@ load("@ytt:overlay", "overlay") #@overlay/match by=overlay.subset({"kind":"KubeadmControlPlane"}) --- spec: kubeadmConfigSpec: preKubeadmCommands: #@overlay/append - echo ' [plugins."io.containerd.grpc.v1.cri".containerd]' >> /etc/containerd/config.toml #@overlay/append - echo ' disable_snapshot_annotations = true' >> /etc/containerd/config.toml #@overlay/append - systemctl restart containerd #@overlay/match by=overlay.subset({"kind":"KubeadmConfigTemplate"}) --- spec: template: spec: preKubeadmCommands: #@overlay/append - echo ' [plugins."io.containerd.grpc.v1.cri".containerd]' >> /etc/containerd/config.toml #@overlay/append - echo ' disable_snapshot_annotations = true' >> /etc/containerd/config.toml #@overlay/append - systemctl restart containerd ```