在 QingCloud (青云) 安装 kubesphere(新)

一、创建VPC及虚拟机

创建VPC及虚拟机可以参考我之前写的这篇文章:谷粒商城-集群-86-K8S 之在 QingCloud (青云) 安装 kubesphere

二、安装kubernetes

1、安装依赖包:

sudo yum install -y yum-utils

2、获取kubernetes

curl -L https://kubesphere.io/download/stable/v2.1.1 > installer.tar.gz \
&& tar -zxf installer.tar.gz && cd kubesphere-all-v2.1.1/conf

编辑主机配置文件 conf/hosts.ini,为了对目标机器及部署流程进行集中化管理配置,集群中各个节点在主机配置文件 hosts.ini中应参考如下配置,建议使用 root用户进行安装。

3、修改配置

[root@master conf]# cat hosts.ini 
; Parameters:
;  ansible_connection: connection type to the target machine
;  ansible_host: the host name of the target machine
;  ip: ip address of the target machine
;  ansible_user: the default user name for ssh connection
;  ansible_ssh_pass: the password for ssh connection
;  ansible_become_pass: the privilege escalation password to grant access
;  ansible_port: the ssh port number, if not 22

; If installer is ran as non-root user who has sudo privilege, refer to the following sample configuration:
; e.g 
;  master ansible_connection=local  ip=192.168.0.5  ansible_user=ubuntu  ansible_become_pass=Qcloud@123 
;  node1  ansible_host=192.168.0.6  ip=192.168.0.6  ansible_user=ubuntu  ansible_become_pass=Qcloud@123
;  node2  ansible_host=192.168.0.8  ip=192.168.0.8  ansible_user=ubuntu  ansible_become_pass=Qcloud@123

; As recommended as below sample configuration, use root account by default to install

[all]
master ansible_connection=local  ip=192.168.0.2
node1  ansible_host=192.168.0.3  ip=192.168.0.3  ansible_ssh_pass=K8stest888
node2  ansible_host=192.168.0.4  ip=192.168.0.4  ansible_ssh_pass=K8stest888

[kube-master]
master

[kube-node]
master
node1
node2

[etcd]
master

[k8s-cluster:children]
kube-node
kube-master 

注意:一定要把 master节点加入到 [kube-node] ,否则在后边的安装会报错。

4、修改安装文件
修改安装文件,只安装Kubernetes,注释掉kubesphere安装:
搜索 multi-node关键词,然后注释掉kubesphere安装语句,注意这里是 muti-node节点的注释,不是单节点的。

[root@master scripts]# pwd
/root/kubesphere-all-v2.1.1/scripts
vi install.sh

file

进入安装目录,建议使用 root 用户执行 install.sh安装脚本。再次提醒大陆用户需要配置镜像加速.

./install.sh

输入数字 2选择第二种 Multi-node 模式开始部署,安装程序会提示您的环境是否前提条件,若满足请输入 "yes" 开始安装。

5、验证kubeneters安装是否成功
(1) 待安装脚本执行完后,请耐心等待,当看到如下 "Successful"的日志,则说明 kubenetes 安装成功。

file

大约过了半个钟,可以看到 kubeneters 已经安装成功了。

检验是否安装成功:

[root@master scripts]# kubectl cluster-info
Kubernetes master is running at https://192.168.0.2:6443
coredns is running at https://192.168.0.2:6443/api/v1/namespaces/kube-system/services/coredns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
[root@master scripts]# 

[root@master scripts]# kubectl get nodes
NAME     STATUS   ROLES    AGE     VERSION
master   Ready    master   9m32s   v1.16.7
node1    Ready    <none>   8m58s   v1.16.7
node2    Ready    <none>   8m58s   v1.16.7

6、master节点打污点
1)、查看master是否有污点

[root@master scripts]# kubectl describe node master | grep Taint
Taints:             <none>

可以看到,这里是没有污点的,如果上边忘记将 master 加入到 node节点,则会出现master污点,需要将污点去掉。

安装openebs

创建 OpenEBS 的 namespace,OpenEBS 相关资源将创建在这个 namespace 下:

kubectl create ns openebs

执行 helm repo update 为安装 OpenEBS做准备

 helm repo update

如果出现报错,可按如下操作:

[root@master scripts]# helm init --client-only --stable-repo-url https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
Creating /root/.helm/repository/repositories.yaml 
Adding stable repo with URL: https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts 
Adding local repo with URL: http://127.0.0.1:8879/charts 
$HELM_HOME has been configured at /root/.helm.
Not installing Tiller due to 'client-only' flag having been set
[root@master scripts]# helm repo list
NAME    URL                                                   
stable  https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
local   http://127.0.0.1:8879/charts                          
[root@master scripts]# helm repo update
Hang tight while we grab the latest from your chart repositories...
...Skip local chart repository
...Successfully got an update from the "stable" chart repository
Update Complete.
[root@master scripts]# 

或者:

[root@master scripts]# helm repo add stable https://charts.ost.ai
"stable" has been added to your repositories

或者:

 echo $(echo -n | openssl s_client -showcerts -connect kubernetes-charts.storage.googleapis.com:443 2>/dev/null  | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p') >> /etc/ssl/certs/ca-certificates.crt

问题援引:https://github.com/helm/helm/issues/4251

安装 OpenEBS,以下列出两种方法,可参考其中任意一种进行创建:

helm install --namespace openebs --name openebs stable/openebs --version 1.5.0

相关文章:
K8S,KubeSphere安装与卸载
kubesphere-minimal下载

为者常成,行者常至