kubectl 自动补全
https://kubernetes.io/zh-cn/docs/tasks/tools/install-kubectl-linux/#enable-shell-autocompletion
1 | 版本替换: |
下载
1 | $ wget -q --no-check-certificate -O kubernetes-1.26.3-aliyun.1-linux-amd64.tar.gz \ |
配置自动补全
1 | $ yum install bash-completion |
docker多平台构建
docker多平台构建像参考文档:
https://docs.docker.com/build/building/multi-platform/
安装docker
二进制安装docker
https://download.docker.com/linux/static/stable/
https://download.docker.com/linux/static/stable/x86_64/docker-24.0.7.tgz
docker 安装
1 | $ wget https://download.docker.com/linux/static/stable/x86_64/docker-24.0.7.tgz |
containerd 安装
contained安装
通过containerd 来创建一个容器,会创建一个 containerd-shim 的进程(垫片),containerd-shim启动后会去启动/usr/bin/containerd-shim-runc-v2,然后立即退出,此时containerd-shim-runc-v2的父进程就变成了systemd(1),这样containerd-shim-runc-v2就和containerd脱离了关系,即便containerd退出也不会影响到容器(这也是containerd-shim套件的作用)。OCI标准(Open Container Initiative 开放容器协议)的具体实现就是runc,真正创建和维护容器最终便是由runc来完成的。/usr/bin/containerd-shim-runc-v2会启动runc去create、start容器,然后runc立即退出,容器的父进程就变成了containerd-shim-runc-v2,这也是容器内部可以看到的PID=1的进程。
containerd
https://github.com/containerd/containerd
https://github.com/containerd/containerd/releases
https://github.com/containerd/containerd/blob/main/docs/cri/crictl.md
https://github.com/containerd/containerd/blob/main/docs/getting-started.md
安装V2
部署X-UI
1 | $ bash <(curl -Ls https://raw.githubusercontent.com/vaxilu/x-ui/master/install.sh) |
buildkit开启使用
系统 | docker | buildx | buildkit |
---|---|---|---|
CentOS 7.9 | 19.03.15 | v0.11.0 | v0.11.6 |
使用buildkit构建
docker 18.09 后才支持, 23.0 才默认开启。
官网介绍:
功能主要是并发构建和多样特性构建支持,完全兼容dockerfile格式
pprof使用
go环境安装
pprof工具是go tool里的工具, 所以需要提前安装golang环境
官方文档: https://go.dev/doc/install
1 | $ wget https://go.dev/dl/go1.20.5.linux-amd64.tar.gz |
containerd 如何拉取镜像
背景
Dockershim从Kubernetes 1.20版本开始废弃,计划在Kubernetes 1.24版本移除,所以目前1.24+的ACK集群只能containerd作为运行时,但是docker build构建的镜像是可以正常使用的, docker build 创建的镜像适用于任何 CRI 实现, 参考 Dockershim Removal FAQ
本文介绍一下containerd运行的节点上如何拉取公共镜像镜像,私有仓库镜像,便于排查containerd节点的免密或者自建镜像仓库的镜像
工具介绍
提示 很多时候我们都可以通过–help来查看工具都提供了哪些功能,因为版本之间直接可能存在兼容性问题
本文对应的软件版本信息(基于阿里云的ACK)
ACK版本 | containerd版本 |
---|---|
v1.24.6-aliyun.1 | containerd 1.6.20 |
containerd 支持的客户端工具有很多, 比如 ctr、nerdctl、crictl、能调用cri接口的如kubelet等,其中是ctr、nerdctl是不支持CRI Plugin,比如镜像加速, 但是可以通过--hosts-dir
的方式指定
本文就通过介绍ctr和crictl, ACK 中默认安装的。
Helm 安装harbor
软件 | 版本 |
---|---|
harbor | Chart Version:1.12.2 App Version:2.8.2 |
k8s | 1.22.15 |
helm | 3.11.1 |
harbor官方文档: https://goharbor.io/docs/edge/install-config/harbor-ha-helm/
下载指定版本harbor
1 | $ sudo helm repo add harbor https://helm.goharbor.io |
istioctl安装istio 1.16.5
软件 | 版本 |
---|---|
Kubernetes | 1.22.15 |
istio | 1.16.5 |
官方文档
k8s和istio支持版本 https://istio.io/latest/docs/releases/supported-releases/#support-status-of-istio-releases
istioctl 安装文档 https://istio.io/latest/docs/setup/getting-started/#download