椭圆曲线密码学(Elliptic curve cryptography,缩写为ECC),一种建立公开金钥加密的算法,基于椭圆曲线数学。椭圆曲线在密码学中的使用是在1985年由Neal Koblitz和Victor Miller分别独立提出的。

内置 ECDSA 公钥的证书一般被称之为 ECC 证书,内置 RSA 公钥的证书就是 RSA 证书。由于 256 位 ECC Key 在安全性上等同于 3072 位 RSA Key,加上 ECC 运算速度更快,ECDHE 密钥交换 + ECDSA 数字签名无疑是最好的选择。由于同等安全条件下,ECC 算法所需的 Key 更短,所以 ECC 证书文件体积比 RSA 证书要小一些。

ECC 证书不仅仅可以用于 HTTPS 场景当中,理论上可以代替所有 RSA 证书的应用场景,如 SSH 密钥登陆、SMTP 的 TLS 发件等。

购买证书需要的CSR请求用openssl创建csr和pkey方法:

1
2
$ openssl ecparam -out ecc.zmq100.cn.ecc.pkey -name prime256v1 -genkey 
$ openssl req -new -key ecc.zmq100.cn.ecc.pkey -sha256 -nodes -out ecc.zmq100.cn.ecc.csr -subj "/CN=ecc.zmq100.cn"

1、创建目录,到目录里。

1
$ mkdir ecc && cd ecc

2、下载acme.sh到本地

1
2
$ wget https://ghproxy.net/https://github.com/acmesh-official/acme.sh/blob/master/acme.sh
$ chmod +x acme.sh
阅读全文 »

背景

使用nginx-ingress遇到backends不更新的问题,在修改svc的 targetPort之后nginx-ingress的backends不能正常更新成新的targetPort。

关于endpointslices,是k8s 1.16 引入的新feature , 目的就是当客户端去get一个很大的endpoint的list的时候可能存在的卡顿,解析资源比较大引发的问题。 所以社区引入endpointslices 资源, 把大的endpoint 分片成很多100个端点块的资源,通过kcm的 --max-endpoints-per-slice 参数调整块大小。

新feature是有很多的问题的,比如kube-proxy 是在1.20之后再引入去获取 endpointslice,看社区出现过一个在使用ExternalName 导致的bug, 在1.23之后的k8s版本中修复了, 类似issue: https://github.com/kubernetes/kubernetes/issues/105986

nginx-ingress-controller 看是在 v1.9.0 之后引入使用的 endpointslices
https://github.com/kubernetes/ingress-nginx/commits/controller-v1.9.0/internal/ingress/controller/endpointslices.go

https://kubernetes.io/zh-cn/docs/concepts/services-networking/endpoint-slices/
https://github.com/kubernetes/kubernetes/commit/75f6c249235b40b24e9ea1efdb1ff81dd76a8d68
https://kubernetes.io/docs/reference/command-line-tools-reference/kube-controller-manager/

阅读全文 »

准备环境

规划

软件 版本 组件 部署方式
操作系统 Ubuntu 22.04.4 LTS containerd 二进制
运行时 Containerd 1.7.20、runc 1.1.13 kubelet 二进制
crictl v1.28.0 ETCD manifests
Kubernetes v1.28.12 KCM manifests
etcd 3.5.12-0 APIserver manifests
coredns 1.9.4 Scheduler manifests
cilium v1.16.0 Coredns deployment
metrics-server v0.7.1 metrics-server deployment
istio 1.22.3 kube-proxy DaemonSet
阅读全文 »

1
orangepi-config

[optional]配置网络等: https://github.com/wukongdaily/OrangePiShell

OrangePi 禁用交换分区的方法

https://blog.csdn.net/Atticus_zhang/article/details/132888408
禁用OrangePi开发板交换分区,需要先关闭开发板 linux 系统的 orangepi-ramlog 和 orangepi-zram 服务。

1
2
3
4
5
$ sudo sed -i "s/ENABLED=true/ENABLED=false/" /etc/default/orangepi-ramlog       # 关闭 orangepi-ramlog
$ sudo sed -i "s/ENABLED=true/ENABLED=false/" /etc/default/orangepi-zram-config # 关闭 orangepi-zram 服务
$ sudo vim /etc/fstab # 然后屏蔽 tmpfs 的配置
# tmpfs /tmp tmpfs defaults, nosuid 0 0
$ sudo reboot

1Panel

https://1panel.cn/docs/installation/online_installation/#2

1
curl -sSL https://resource.fit2cloud.com/1panel/package/quick_start.sh -o quick_start.sh && sudo bash quick_start.sh
阅读全文 »

创建一个新的repository

在新仓库创建一下阿里云个人版账号密码

Settings --> Actions secrets and variables --> Actions --> Repository secrets

创建如下两个secrets 填写个人版本镜像拉取账号密码
Key如下 REGISTRY_USERNAMEREGISTRY_PASSWORD

阅读全文 »

https://kubernetes.io/zh-cn/docs/tasks/tools/install-kubectl-linux/#enable-shell-autocompletion

1
2
3
4
5
6
7
8
其他版本,以下oss地址替换如下:
1.28.3
1.26.3
1.24.6
1.22.15
1.20.11
1.18.8
1.16.9

下载

1
2
3
4
5
6
7
8
9
10
$ wget -q --no-check-certificate -O kubernetes-1.26.3-aliyun.1-linux-amd64.tar.gz \
--tries 5 --connect-timeout 5 \
http://aliacs-k8s-cn-hangzhou.oss-cn-hangzhou-internal.aliyuncs.com/public/pkg/kubernetes/kubernetes-1.26.3-aliyun.1-linux-amd64.tar.gz

# 脚本
$ wget --no-check-certificate -O run-1.26-linux-amd64.tar.gz \
--tries 1 --connect-timeout 5 \
http://aliacs-k8s-cn-hangzhou.oss-cn-hangzhou-internal.aliyuncs.com/public/pkg/run/run-1.26-linux-amd64.tar.gz

$ cp pkg/kubernetes/1.26.3-aliyun.1/bin/kubectl/usr/bin/kubectl /usr/bin/

配置自动补全

1
2
3
4
$ yum install bash-completion
$ kubectl completion bash | sudo tee /etc/bash_completion.d/kubectl > /dev/null
$ chmod a+r /etc/bash_completion.d/kubectl
$ source ~/.bashrc

ssh心跳

1
2
3
4
$ vim /etc/ssh/ssh_config
...
Host *
ServerAliveInterval 30

docker多平台构建像参考文档:
https://docs.docker.com/build/building/multi-platform/

安装docker

一键安装

1
$ sudo curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

二进制安装docker

https://download.docker.com/linux/static/stable/
https://download.docker.com/linux/static/stable/x86_64/docker-24.0.7.tgz

docker 安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
$ wget https://download.docker.com/linux/static/stable/x86_64/docker-24.0.7.tgz
$ tar zxvf docker-24.0.7.tgz
docker/
docker/docker-init
docker/containerd-shim-runc-v2
docker/ctr
docker/docker-proxy
docker/dockerd
docker/docker
docker/containerd
docker/runc
$ mv docker/* /usr/bin

$ wget -O /usr/lib/systemd/system/docker.service \
https://raw.githubusercontent.com/docker/packaging/main/pkg/docker-engine/common/systemd/docker.service
# 删除 Requires=docker.socket containerd.service
# 替换 ExecStart=/usr/bin/dockerd --exec-opt native.cgroupdriver=systemd

$ systemctl daemon-reload
$ systemctl enable docker
阅读全文 »

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

阅读全文 »