1、KubeSphere

KubeSphere all-in-one模式安装

https://kubesphere.io/zh/docs/quick-start/all-in-one-on-linux/

1、安装

1、前提条件

1、硬件推荐配置

image.png

2、节点要求
  • 节点必须能够通过 SSH 连接。
  • 节点上可以使用 sudo/curl/openssl 命令。

    3、容器运行时
  • 您的集群必须有一个可用的容器运行时。如果您使用 KubeKey 搭建集群,KubeKey 会默认安装最新版本的 Docker。或者,您也可以在创建集群前手动安装 Docker 或其他容器运行时。

    2、下载 KubeKey

    1、先执行以下命令以确保您从正确的区域下载 KubeKey。
    1. export KKZONE=cn

    2、执行以下命令下载 KubeKey。
  • 下载不下来就直接下载这个地址的内容然后,去执行吧

    curl -sfL https://get-kk.kubesphere.io | VERSION=v1.1.1 sh -
    

    3、为 kk 添加可执行权限
    chmod +x kk
    

    3、开始安装

    1、安装

    ```shell ./kk create cluster —with-kubernetes v1.20.4 —with-kubesphere v3.1.1

<a name="Qe8bb"></a>
##### 2、报错
![image.png](https://cdn.nlark.com/yuque/0/2021/png/12971636/1632630580151-0615bca6-1e35-4668-87f1-294b894634c2.png#clientId=u3aa4350d-9e0e-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=87&id=ua1febdec&margin=%5Bobject%20Object%5D&name=image.png&originHeight=174&originWidth=1932&originalType=binary&ratio=1&rotation=0&showTitle=false&size=126974&status=done&style=none&taskId=u1e35fbae-9162-4876-bd72-2dd2783e664&title=&width=966)

- 解决
   - 安装工具
```shell
yum install conntrack-tools

4、验证安装结果

kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f

5、登录

  • 安装完成之后 ```shell
    #

    Welcome to KubeSphere!

    #

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

NOTES:

  1. After you log into the console, please check the monitoring status of service components in “Cluster Management”. If any service is not ready, please wait patiently until all components are up and running.
  2. Please change the default password after login.

- 就可以安装自己的网络ip进行访问,有时候这个ip10.0.2.15他不是你的网卡
   - 我这里是访问的[http://192.168.33.20:30880/](http://192.168.33.20:30880/)
   - 进去之后会让你修改密码,我这里修改了一下密码
- ![image.png](https://cdn.nlark.com/yuque/0/2021/png/12971636/1632630746950-05d1a139-4701-4fe3-aec8-72faf6e38a28.png#clientId=u3aa4350d-9e0e-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=652&id=u248b4e45&margin=%5Bobject%20Object%5D&name=image.png&originHeight=1304&originWidth=2860&originalType=binary&ratio=1&rotation=0&showTitle=false&size=169108&status=done&style=none&taskId=u6d3d0e85-7833-4b17-97f3-63ecd677c2f&title=&width=1430)
<a name="yBdmq"></a>
#### 6、当前安装的最小化模式

- 开启一些其他组件参考如下文档
- [https://kubesphere.io/zh/docs/pluggable-components/](https://kubesphere.io/zh/docs/pluggable-components/)
<a name="WOx2c"></a>
## 2、添加新节点
[https://kubesphere.io/zh/docs/installing-on-linux/cluster-operation/add-new-nodes/](https://kubesphere.io/zh/docs/installing-on-linux/cluster-operation/add-new-nodes/)

- 要先准备好linux机器
   - 最好机器先配置好网络
   - 安装好docker,配置上阿里云加速镜像
      - 如果不提前安装也会安装,但是不会为你配置镜像
      - 为了速度快点就最好自己先安装好docker
   - 并且安装一下yum install conntrack-tools
      - 不然会报错
<a name="IPfoE"></a>
### 1、使用 KubeKey 检索集群信息。以下命令会创建配置文件 (sample.yaml)
```shell
./kk create config --from-cluster
  • 如果您的机器上已有配置文件,就可以跳过此步骤。例如,若要将节点添加到由 KubeKey 设置的多节点集群,如果您没有删除该集群,则可能仍拥有该配置文件。

    2、在配置文件中,将新节点的信息放在 hosts 和 roleGroups 之下。该示例添加了两个新节点(即 node1 和 node2)。这里的 master1 是现有节点。

    ```yaml apiVersion: kubekey.kubesphere.io/v1alpha1 kind: Cluster metadata: name: sample spec: hosts:

    You should complete the ssh information of the hosts

    • {name: localhost.localdomain, address: 10.0.2.12, internalAddress: 10.0.2.12, user: root, password: vagrant}
    • {name: k8s-kubesphere-node1, address: 10.0.2.10, internalAddress: 10.0.2.10, user: root, password: vagrant}
    • {name: k8s-kubesphere-node2, address: 10.0.2.11, internalAddress: 10.0.2.11, user: root, password: vagrant}
    • {name: k8s-kubesphere-node3, address: 10.0.2.15, internalAddress: 10.0.2.15, user: root, password: vagrant} roleGroups: etcd:
      • localhost.localdomain master:
      • localhost.localdomain worker:
      • localhost.localdomain
      • k8s-kubesphere-node1
      • k8s-kubesphere-node2
      • k8s-kubesphere-node3 controlPlaneEndpoint:

        If loadbalancer was used, ‘address’ should be set to loadbalancer’s ip.

        domain: lb.kubesphere.local address: “” port: 6443 kubernetes: version: v1.20.4 clusterName: cluster.local proxyMode: ipvs masqueradeAll: false maxPods: 110 nodeCidrMaskSize: 24 network: plugin: calico kubePodsCIDR: 10.233.64.0/18 kubeServiceCIDR: 10.233.0.0/18 registry: privateRegistry: “”
<a name="HHqdQ"></a>
### 3、执行以下命令
```shell
./kk add nodes -f sample.yaml
  • 如果出现错误
    • [SHOULD_BE_REPLACED] is in [etcd] group, but not in hosts list
    • 检查一下sample.yaml中是否已经配置了主节点image.png
  • 这种方式我还没安装成功

    4、重置节点

    kubeadm reset
    

3、相关功能介绍

1、可以使用kubesphere来访问控制台

image.png
image.png

4、创建并部署 WordPress

https://kubesphere.io/zh/docs/quick-start/wordpress-deployment/