基于 k3s 快速搭建单体应用环境,包含数据库(mariadb)、对象存储(minio)、SSL证书颁发(letsencrypt)及可选的 Ingress 组件(ingress-nginx)。
curl -sfL https://get.k3s.io | sh -s -
curl -sfL https://get.k3s.io | sh -s - --disable=traefik
touch /etc/rancher/k3s/registries.yaml
cat > /etc/rancher/k3s/registries.yaml <<EOF
mirrors:
docker.io:
endpoint:
- "http://mycustomreg.com:5000"
EOF
touch /etc/rancher/k3s/registries.yaml
cat > /etc/rancher/k3s/registries.yaml <<EOF
mirrors:
docker.io:
endpoint:
- "http://mycustomreg.com:5000"
configs:
"mycustomreg:5000":
auth:
username: xxxxxx # this is the registry username
password: xxxxxx # this is the registry password
EOF
在 github 开发者设置中创建 Personal Access Token
,选中 read packages
权限即可
kubectl create secret docker-registry ghcr --docker-server=ghcr.io --docker-username=yourname --docker-password=your_github_pat
使用时在 deployment 中配置
imagePullSecrets:
- name: ghcr
# 在 onek3s 目录中执行
helm install onek3s . \
--set minio.apiIngress.hostname=oss.example.org \
--set clusterIssuer.enabled=true \
--set clusterIssuer.email=admin@example.org
或者直接编辑 values.yaml
文件后执行 install