nerdctl全家桶配置

export image=szxyanhai;
nerdctl build -t registry-vpc.cn-shenzhen.aliyuncs.com/liweilun/gongwang-"$image" /opt/"$image"docker --cache-from type=local,src=/opt/imgbuildcache --cache-to type=local,dest=/opt/imgbuildcache --data-root /opt/nerdctl --snapshotter=stargz;
nerdctl push registry-vpc.cn-shenzhen.aliyuncs.com/liweilun/gongwang-"$image" --estargz --data-root /opt/nerdctl;
kubectl rollout restart deployment "$image"

buildkit配置systemd文件

--root就是代表buildkit的数据目录

[Unit]
After=network.target local-fs.target
[Service]
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/local/bin/buildkitd --root /opt/buildkit  --containerd-worker-snapshotter=stargz
Type=notify
Delegate=yes
KillMode=process
Restart=always
RestartSec=5
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNPROC=infinity
LimitCORE=infinity
LimitNOFILE=infinity
# Comment TasksMax if your systemd version does not supports it.
# Only systemd 226 and above support this version.
TasksMax=infinity
OOMScoreAdjust=-999
[Install]
WantedBy=multi-user.target

containerd-stargz-grpc配置systemd文件

--root就是代表containerd-stargz-grpc的数据目录

[Unit]
Description=stargz snapshotter
After=network.target
Before=containerd.service
[Service]
Type=notify
Environment=HOME=/root
ExecStart=/usr/local/bin/containerd-stargz-grpc --root /opt/containerd-stargz-grpc --log-level=debug --config=/etc/containerd-stargz-grpc/config.toml
Restart=always
RestartSec=1
[Install]
WantedBy=multi-user.target

用了containerd-stargz-grpc之后重启服务器的时候可能umount的有点多,重启速度有点慢

containerd配置镜像懒加载lazy-pulling (Stargz)

sed -i "s#disable_snapshot_annotations\(.*\)#disable_snapshot_annotations\ =\ false#g" /etc/containerd/config.toml;
sed -i "s#snapshotter\ =\(.*\)#snapshotter\ =\ \"stargz\"#g" /etc/containerd/config.toml;
[proxy_plugins]
  [proxy_plugins.stargz]
    type = "snapshot"
    address = "/run/containerd-stargz-grpc/containerd-stargz-grpc.sock"

你可能感兴趣的:(kubernetes,linux,kubernetes)