51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

k8s 单节点安装(基于kubesphere)

卸载:

./kk delete cluster -f config-sample.yaml

最低配置 : 8H 16G (跑devops)

KubeSphere:v3.3.2

Kubernetes:v1.23.10

一定要注意时区: 参考连接

不然用velero备份的时候 会出问题。

docker镜像拉不下来解决方法 : 链接

1 - 安装系统依赖

# 安装 Kubernetes 系统依赖包
yum install curl socat conntrack ebtables ipset ipvsadm -y

2- 安装nfs 存储

yum install -y nfs-utils

echo "/mnt/nfs/k8sdata *(rw,sync,no_root_squash)" >> /etc/exports

systemctl start nfs

systemctl enable nfs

showmount -e

如果你系统是 centos8: 参考连接

开始安装:

mkdir kubekey
cd kubekey/

# 选择中文区下载(访问github受限时使用)
export KKZONE=cn
curl -sfL https://get-kk.kubesphere.io | VERSION=v3.0.7 sh -

# 这里下不来,换

curl -sfL https://get-kk.kubesphere.io | sh - 

下完后:

配置文件:

config-sample.yaml 单节点

1-配置节点:

不带端口的 (我自己测试集群用的这个)

  hosts:
  - {name: master1, address: 172.17.15.252, internalAddress: 172.17.15.252, user: root, password: "."}

带端口的

hosts:

  - {name: master, address: 192.168.0.2, internalAddress: 192.168.0.2, port: 8022, user: ubuntu, password: Testing123}

带秘钥的:

- {name: worker1, address: 192.168.1.211, internalAddress: 192.168.1.211, user: root,privateKeyPath: "~/.ssh/id_ed25519"}

因为是一个节点,我们不需要 开启负载均衡

  controlPlaneEndpoint:
    ## Internal loadbalancer for apiservers 
    # internalLoadbalancer: haproxy

    domain: lb.kubesphere.local
    address: ""
    port: 6443

配置nfs:

  addons:
  - name: nfs-client
    namespace: kube-system
    sources:
      chart:
        name: nfs-client-provisioner
        repo: https://charts.kubesphere.io/main
        valuesFile: ./nfs-client.yaml

这里在当前目录下 新建一个 nfs-client.yaml

内容如下:

nfs:
  server: "172.17.15.252"
  path: "/mnt/nfs/k8sdata"
storageClass:
  defaultClass: true

整体配置 文件 config-sample.yaml

1- 开始安装:

./kk create cluster -f config-sample.yaml 

如果你已经安装了 docker

需要做个软连接

 ln -s /usr/local/bin/docker /usr/bin/docker

which docker 看看是否在 /usr/bin/ 下。

最后:

Console: http://172.17.15.252:30880
Account: admin
Password: P@88w0rd

{#more-14431}

Start installing monitoring
Start installing multicluster
Start installing openpitrix
Start installing network
Start installing devops
Start installing logging
**************************************************
Waiting for all tasks to be completed ...
task network status is successful  (1/6)
task multicluster status is successful  (2/6)
task openpitrix status is successful  (3/6)
task logging status is successful  (4/6)
task devops status is successful  (5/6)
task monitoring status is successful  (6/6)
赞(6)
未经允许不得转载:工具盒子 » k8s 单节点安装(基于kubesphere)