快速初始化k8s集群-sealos

https://www.sealos.io/zh-Hans/docs/getting-started/offline-install

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 下载sealos
wget https://ghproxy.com/https://github.com/labring/sealos/releases/download/v4.1.4/sealos_4.1.4_linux_amd64.tar.gz \
&& tar zxvf sealos_4.1.4_linux_amd64.tar.gz sealos && chmod +x sealos && mv sealos /usr/bin

# sealos部署是一种插件形式
labring/kubernetes-docker:v1.20.9 --> docker
labring/kubernetes:v1.25.0 --> containerd
安装其他插件时必须先安装labring/helm:v3.8.2

sealos run labring/kubernetes-docker:v1.20.9 labring/helm:v3.8.2 labring/calico:v3.22.1 \
--masters 172.12.1.102 --passwd 123456


sealos_v4.3.7

sealos run labring/kubernetes-docker:v1.22.17-4.3.7 labring/helm:v3.12.3 labring/calico:v3.24.6 --masters 172.12.1.150 --passwd 123456


sealos run labring/kubernetes-docker:v1.26.14-amd64 labring/helm:v3.14.1 labring/calico:v3.26.1-amd64 --masters 192.168.14.18 --passwd 123456


1.26(23-25没测) 以上的版本,svc无法ping通 但可访问 https://github.com/kubernetes/kubernetes/issues/119613

自定义安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
VERSION=4.3.7
wget https://github.com/labring/sealos/releases/download/v${VERSION}/sealos_${VERSION}_linux_amd64.tar.gz && \
tar -zxvf sealos_${VERSION}_linux_amd64.tar.gz sealos && chmod +x sealos && mv sealos /usr/bin
wget https://ghproxy.com/https://github.com/labring/sealos/releases/download/v${VERSION}/sealos_${VERSION}_linux_amd64.tar.gz \
&& tar zxvf sealos_${VERSION}_linux_amd64.tar.gz sealos && chmod +x sealos && mv sealos /usr/bin




sealos gen labring/kubernetes-docker:v1.22.17 labring/helm:v3.12.3 labring/calico:v3.24.6 --masters 172.12.1.150 --passwd 123456 --output C1

#
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
networking:
podSubnet: 172.20.0.0/16
dnsDomain: test.local
serviceSubnet: 172.21.0.0/16
---
apiVersion: apps.sealos.io/v1beta1
kind: Config
metadata:
name: calico
spec:
path: charts/calico/values.yaml
strategy: merge
data: |
installation:
enabled: true
kubernetesProvider: ""
calicoNetwork:
ipPools:
- blockSize: 26
cidr: 172.20.0.0/16
encapsulation: IPIP
natOutgoing: Enabled
nodeSelector: all()
nodeAddressAutodetectionV4:
interface: "eth.*|en.*"


sealos apply -f Clusterfile


sealos run labring/ingress-nginx:v1.8.1

kubeadm config print init-defaults

部署docker-registry-web

1
2
3
4
5
6
7
8
9
docker run -d \
--name registry-web \
-p 8080:8080 \
-e REGISTRY_URL=http://<节点ip>:5000/v2 \
-e REGISTRY_NAME=sealos.hub:5000 \ #镜像仓库名
-e REGISTRY_BASIC_AUTH="YWRtaW46cGFzc3cwcmQ=" \ # -u admin -p passw0rd
-e REGISTRY_READONLY=false \
-e DOCKER_REGISTRY_USE_SSL=false \
hyper/docker-registry-web:latest