kubekey 安装单节点 kubernetes

下载kubekey

```shell
❯ curl -sfL https://get-kk.kubesphere.io | sh - Downloading kubekey v3.1.1 from https://github.com/kubesphere/kubekey/releases/download/v3.1.1/kubekey-v3.1.1-linux-amd64.tar.gz ... Kubekey v3.1.1 Download Complete! ❯ ls kk kubekey-v3.1.1-linux-amd64.tar.gz mv kk /usr/bin/

 ```

查看kubekey version 及支持创建什么版本的集群

```shell

❯ kk version
kk version: &version.Info{Major:"3", Minor:"1", GitVersion:"v3.1.1", GitCommit:"7a184f786b02bec20d5534af137896f50e510396", GitTreeState:"clean", BuildDate:"2024-04-16T04:28:43Z", GoVersion:"go1.19.2", Compiler:"gc", Platform:"linux/amd64"}
❯ kk version --show-supported-k8s

``` 

设置环境变量

```shell

❯ export KKZONE=cn
❯ echo $KKZONE
cn

 ```

安装依赖项

```shell

❯ apt install -y socat conntrack ebtables ipset

 ```

安装集群

```shell

kk create cluster --with-kubernetes v1.23.10


 _   __      _          _   __           
| | / /     | |        | | / /           
| |/ / _   _| |__   ___| |/ /  ___ _   _ 
|    \| | | | '_ \ / _ \    \ / _ \ | | |
| |\  \ |_| | |_) |  __/ |\  \  __/ |_| |
\_| \_/\__,_|_.__/ \___\_| \_/\___|\__, |
                                    __/ |
                                   |___/

07:11:30 UTC [GreetingsModule] Greetings
07:11:30 UTC message: [test-server]
Greetings, KubeKey!
07:11:30 UTC success: [test-server]
07:11:30 UTC [NodePreCheckModule] A pre-check on nodes
07:11:30 UTC success: [test-server]
07:11:30 UTC [ConfirmModule] Display confirmation form
+---------+------+------+---------+----------+-------+-------+---------+-----------+--------+--------+------------+------------+-------------+------------------+--------------+
| name    | sudo | curl | openssl | ebtables | socat | ipset | ipvsadm | conntrack | chrony | docker | containerd | nfs client | ceph client | glusterfs client | time         |
+---------+------+------+---------+----------+-------+-------+---------+-----------+--------+--------+------------+------------+-------------+------------------+--------------+
| test-server | y    | y    | y       | y        | y     | y     |         | y         | y      | 24.0.6 | v1.7.3     | y          |             |                  | UTC 07:11:30 |
+---------+------+------+---------+----------+-------+-------+---------+-----------+--------+--------+------------+------------+-------------+------------------+--------------+

...
Installation is complete.

Please check the result using the command:

        kubectl get pod -A

❯ kubectl get nodes
NAME     	 STATUS   ROLES                         AGE   VERSION
test-server  Ready    control-plane,master,worker   24s   v1.23.10

 ```

 

 

卸载

```shell 

kk delete cluster

rm -rf ~/.kube/

```

posted @ 2024-05-15 15:27  小卡拉米丶  阅读(48)  评论(0)    收藏  举报