sealos 创建单节点集群

1. sealos 安装

2. 创建一个k8s集群

  1. 方式1
    参考 kuberentes-life-cycle
# sealos version must >= v4.1.0
$ sealos run labring/kubernetes:v1.25.0 labring/helm:v3.8.2 labring/calico:v3.24.1 --single
  1. 方式2
    创建Clusterfile文件
apiVersion: apps.sealos.io/v1beta1
kind: Cluster
metadata:
  creationTimestamp: null
  name: default
spec:
  hosts:
  - ips:
    - 172.16.51.5:22
    roles:
    - master
    - amd64
#  - ips:
#    - 172.16.51.12:22
#    roles:
#    - node
#    - amd64
  image:
  - labring/kubernetes-docker:v1.26.1
  - labring/helm:v3.10.3
  - labring/calico:v3.25.0
  ssh:
    passwd: ${ssh登录密码}
    pk: /root/.ssh/id_rsa
    port: 22
    user: root
status: {}
 
# 执行安装  
sealos apply -f Clusterfile

3. 允许master节点调度pod

kubectl taint node ${master节点名称} node-role.kubernetes.io/control-plane:NoSchedule-

4. 部署nginx-ingress

常见错误处理

invalid capacity 0 on image filesystem

1.修改/etc/default/grub

添加一行

GRUB_CMDLINE_LINUX="cgroup_enable=cpu"
  1. 自定义cidr
apiVersion: apps.sealos.io/v1beta1
kind: Cluster
metadata:
  creationTimestamp: "2024-08-27T05:47:03Z"
  name: default
spec:
  hosts:
  - ips:
    - 100.73.1.132:22
apiVersion: apps.sealos.io/v1beta1
kind: Cluster
metadata:
  creationTimestamp: "2024-08-27T05:47:03Z"
  name: default
spec:
  hosts:
  - ips:
    - 100.73.1.132:22
    roles:
    - master
    - amd64
  image:
  - registry.cn-shanghai.aliyuncs.com/labring/kubernetes:v1.27.8
  - registry.cn-shanghai.aliyuncs.com/labring/helm:v3.13.2
  - registry.cn-shanghai.aliyuncs.com/labring/calico:v3.26.1
  ssh: {}

---
apiServer: {}
apiVersion: kubeadm.k8s.io/v1beta3
controllerManager: {}
dns: {}
etcd: {}
kind: ClusterConfiguration
networking:
  serviceSubnet: 172.16.0.0/16
  podSubnet: 192.168.17.0/24
scheduler: {}

---
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: 24
          cidr: 192.168.17.0/24
          encapsulation: IPIP
          natOutgoing: Enabled
          nodeSelector: all()
        nodeAddressAutodetectionV4:
          interface: "eth.*|en.*"
posted @ 2022-10-16 21:27  gui.h  阅读(202)  评论(0编辑  收藏  举报