单机 KubeSphere v3.0的安装

2024-04-09 07:08
文章标签 安装 kubesphere 单机 v3.0

本文主要是介绍单机 KubeSphere v3.0的安装,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

单机 KubeSphere v3.0的安装

我是在虚拟机环境中安装的,4C、32G、120GB
注意:平台之间依赖厂家经过测试的版本,千万不要选择未经测试的版本,否则会卡在哪里得不到解决。
选择CentOS 7.7 + docker 19.3.14 + kubernetes 1.18.6 + kubesphere 3.0.0

0、安装虚拟机

VMware workstations

1、安装Linux

CentOS 7.7,最小安装,然后配置网卡

2、安装Docker

参考如下,贴子很多

systemctl disable firewalld
systemctl status firewalld
sed -i 's/enforcing/disabled/' /etc/selinux/config
setenforce 0
cat /etc/selinux/config
swapoff -a
sed -ri 's/.*swap.*/#&/' /etc/fstab
free -l -h
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
echo "net.bridge.bridge-nf-call-ip6tables = 1" >> /etc/sysctl.conf
echo "net.bridge.bridge-nf-call-iptables = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.default.disable_ipv6 = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.lo.disable_ipv6 = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.all.forwarding = 1"  >> /etc/sysctl.conf
sysctl -p
yum remove docker \docker-client \docker-client-latest \docker-common \docker-latest \docker-latest-logrotate \docker-logrotate \docker-engine
yum install -y yum-utils \device-mapper-persistent-data \lvm2
yum-config-manager \--add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repoyum install -y docker-ce-19.03.14 docker-ce-cli-19.03.14 containerd.io
systemctl enable docker
systemctl start docker
docker version

3、安装KubeSphere

export KKZONE=cn
curl -sfL https://get-kk.kubesphere.io | VERSION=v1.0.1 sh -

Downloading kubekey v1.0.1 from https://kubernetes.pek3b.qingstor.com/kubekey/releases/download/v1.0.1/kubekey-v1.0.1-linux-amd64.tar.gz …

Kubekey v1.0.1 Download Complete!

chmod +x kk
docker version
yum install -y socat conntrack

保证如下组件安装了:sudo curl openssl ebtables socat ipset conntrack docker,务必在开始下面命令前安装完这些相关必要的组件

./kk create cluster --with-kubernetes v1.18.6 --with-kubesphere v3.0.0

下面为这个命令的输出:
Continue this installation? [yes/no]: yes
INFO[13:04:49 CST] Downloading Installation Files
INFO[13:04:49 CST] Downloading kubeadm …
INFO[13:04:50 CST] Downloading kubelet …
INFO[13:04:51 CST] Downloading kubectl …
INFO[13:04:51 CST] Downloading helm …
INFO[13:04:51 CST] Downloading kubecni …
INFO[13:04:52 CST] Configurating operating system …

INFO[13:04:55 CST] Installing docker …
INFO[13:04:55 CST] Start to download images on all nodes
[k8s-kubesphere] Downloading image: kubesphere/etcd:v3.3.12
[k8s-kubesphere] Downloading image: kubesphere/pause:3.2

[k8s-kubesphere] Downloading image: coredns/coredns:1.6.9
[k8s-kubesphere] Downloading image: kubesphere/k8s-dns-node-cache:1.15.12
[k8s-kubesphere] Downloading image: calico/kube-controllers:v3.15.1

[k8s-kubesphere] Downloading image: calico/pod2daemon-flexvol:v3.15.1

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown ( i d − u ) : (id -u): (idu):(id -g) $HOME/.kube/config

You should now deploy a pod network to the cluster.
Run “kubectl apply -f [podnetwork].yaml” with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/

You can now join any number of control-plane nodes by copying certificate authorities
and service account keys on each node and then running the following as root:
kubeadm join lb.kubesphere.local:6443 --token 7n691x.e88u2nmc7cy99plj
–discovery-token-ca-cert-hash sha256:f535950e23fbc39e1956e6f4c5ccecd29a9ffd1d432d2f157cbaad5bbdd873a8
–control-plane

Then you can join any number of worker nodes by running the following on each as root:
kubeadm join lb.kubesphere.local:6443 --token 7n691x.e88u2nmc7cy99plj
–discovery-token-ca-cert-hash sha256:f535950e23fbc39e1956e6f4c5ccecd29a9ffd1d432d2f157cbaad5bbdd873a8

NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
k8s-kubesphere NotReady master,worker 46s v1.18.6 8.1.3.151 CentOS Linux 7 (Core) 3.10.0-1062.el7.x86_64 docker://19.3.14
INFO[13:08:48 CST] Deploying KubeSphere …
v3.0.0

INFO[13:14:29 CST] Installation is complete.
注意:到这里基本是安装完成了,如果出错就从头排查,建议做好虚拟机的备份,以便知道改动了哪里!!!

Please check the result using the command:
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath=’{.items[0].metadata.name}’) -f

4、验证安装是否正常

执行下面命令

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

应该输出:

#####################################################
###              Welcome to KubeSphere!           ###
#####################################################Console: http://8.1.3.151:30880
Account: admin
Password: P@88w0rdNOTES:1. After logging into the console, please check themonitoring status of service components inthe "Cluster Management". If any service is notready, please wait patiently until all components are ready.2. Please modify the default password after login.#####################################################
https://kubesphere.io             2021-01-14 08:20:51
#####################################################

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

5、出现错误的情况

安装完成后,我都是重启了两遍虚拟机,然后才全部正常的

最常见的就是下载组件pod等时网络不通或者速度过慢,导致失败
一般就是反复尝试并切换到国内的镜像源上。

部署Kubernetes时出现ImagePullBackOff或ErrImagePull情况

参考:https://blog.csdn.net/lin_yx/article/details/111599937

第一步:查看那些pod不正常
kubectl get pod --all-namespaces

#kubectl get pod --all-namespaces
NAMESPACE                      NAME                                               READY   STATUS    RESTARTS   AGE
kube-system                    calico-kube-controllers-578894d4cd-jdsmt           1/1     Running   2          20h
kube-system                    calico-node-gpvlx                                  1/1     Running   2          20h
kube-system                    coredns-6b55b6764d-84mxp                           1/1     Running   2          20h
kube-system                    coredns-6b55b6764d-k6bzr                           1/1     Running   2          20h
kube-system                    kube-apiserver-k8s-kubesphere                      1/1     Running   2          20h
kube-system                    kube-controller-manager-k8s-kubesphere             1/1     Running   2          20h
kube-system                    kube-proxy-f7wrb                                   1/1     Running   4          20h
kube-system                    kube-scheduler-k8s-kubesphere                      1/1     Running   2          20h
kube-system                    metrics-server-f47758d8f-rswq5                     1/1     Running   2          18h
kube-system                    nodelocaldns-tfrlx                                 1/1     Running   2          20h
kube-system                    openebs-localpv-provisioner-84446d4bd7-b4hft       1/1     Running   1          20h
kube-system                    openebs-ndm-l9cp7                                  1/1     Running   3          20h
kube-system                    openebs-ndm-operator-6456dc9db-w2d6w               1/1     Running   2          20h
kube-system                    snapshot-controller-0                              1/1     Running   1          18h
kubesphere-controls-system     default-http-backend-857d7b6856-g8ljk              1/1     Running   1          18h
kubesphere-controls-system     kubectl-admin-58f985d8f6-jsshk                     1/1     Running   1          17h
kubesphere-monitoring-system   alertmanager-main-0                                2/2     Running   2          18h
kubesphere-monitoring-system   kube-state-metrics-95c974544-nw6vw                 3/3     Running   3          18h
kubesphere-monitoring-system   node-exporter-29zwp                                2/2     Running   2          18h
kubesphere-monitoring-system   notification-manager-deployment-7c8df68d94-6mk8m   1/1     Running   1          17h
kubesphere-monitoring-system   notification-manager-operator-6958786cd6-5hphl     2/2     Running   2          18h
kubesphere-monitoring-system   prometheus-k8s-0                                   3/3     Running   4          18h
kubesphere-monitoring-system   prometheus-operator-84d58bf775-kz29n               2/2     Running   2          18h
kubesphere-system              ks-apiserver-67c5fcfc66-xdlnw                      1/1     Running   0          91m
kubesphere-system              ks-console-b4df86d6f-vc8bl                         1/1     Running   1          18h
kubesphere-system              ks-controller-manager-57b966f8f4-b2p72             1/1     Running   0          91m
kubesphere-system              ks-installer-7cb866bd-bsfrt                        1/1     Running   1          20h
kubesphere-system              openldap-0                                         1/1     Running   1          18h
kubesphere-system              redis-644bc597b9-5kzsp                             1/1     Running   1          18h

kubectl get pods -n kube-system
第二步:查看这些不正常pod的原因
kubectl describe kubesphere-system/xxxxx --namespace kube-system
注意:一定要加上命名空间
第三步:手动下载pod,那个有问题就下载那个,一定要加上版本
docker pull kubesphere/xxxxx,卡在哪就下哪个,而且下载用describe看到的版本

这篇关于单机 KubeSphere v3.0的安装的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/887496

相关文章

如何解决mmcv无法安装或安装之后报错问题

《如何解决mmcv无法安装或安装之后报错问题》:本文主要介绍如何解决mmcv无法安装或安装之后报错问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录mmcv无法安装或安装之后报错问题1.当我们运行YOwww.chinasem.cnLO时遇到2.找到下图所示这里3.

Python 安装和配置flask, flask_cors的图文教程

《Python安装和配置flask,flask_cors的图文教程》:本文主要介绍Python安装和配置flask,flask_cors的图文教程,本文通过图文并茂的形式给大家介绍的非常详细,... 目录一.python安装:二,配置环境变量,三:检查Python安装和环境变量,四:安装flask和flas

Win11安装PostgreSQL数据库的两种方式详细步骤

《Win11安装PostgreSQL数据库的两种方式详细步骤》PostgreSQL是备受业界青睐的关系型数据库,尤其是在地理空间和移动领域,:本文主要介绍Win11安装PostgreSQL数据库的... 目录一、exe文件安装 (推荐)下载安装包1. 选择操作系统2. 跳转到EDB(PostgreSQL 的

Linux系统中卸载与安装JDK的详细教程

《Linux系统中卸载与安装JDK的详细教程》本文详细介绍了如何在Linux系统中通过Xshell和Xftp工具连接与传输文件,然后进行JDK的安装与卸载,安装步骤包括连接Linux、传输JDK安装包... 目录1、卸载1.1 linux删除自带的JDK1.2 Linux上卸载自己安装的JDK2、安装2.1

Linux卸载自带jdk并安装新jdk版本的图文教程

《Linux卸载自带jdk并安装新jdk版本的图文教程》在Linux系统中,有时需要卸载预装的OpenJDK并安装特定版本的JDK,例如JDK1.8,所以本文给大家详细介绍了Linux卸载自带jdk并... 目录Ⅰ、卸载自带jdkⅡ、安装新版jdkⅠ、卸载自带jdk1、输入命令查看旧jdkrpm -qa

MySQL Workbench 安装教程(保姆级)

《MySQLWorkbench安装教程(保姆级)》MySQLWorkbench是一款强大的数据库设计和管理工具,本文主要介绍了MySQLWorkbench安装教程,文中通过图文介绍的非常详细,对大... 目录前言:详细步骤:一、检查安装的数据库版本二、在官网下载对应的mysql Workbench版本,要是

Linux安装MySQL的教程

《Linux安装MySQL的教程》:本文主要介绍Linux安装MySQL的教程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录linux安装mysql1.Mysql官网2.我的存放路径3.解压mysql文件到当前目录4.重命名一下5.创建mysql用户组和用户并修

pip无法安装osgeo失败的问题解决

《pip无法安装osgeo失败的问题解决》本文主要介绍了pip无法安装osgeo失败的问题解决,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一... 进入官方提供的扩展包下载网站寻找版本适配的whl文件注意:要选择cp(python版本)和你py

Android App安装列表获取方法(实践方案)

《AndroidApp安装列表获取方法(实践方案)》文章介绍了Android11及以上版本获取应用列表的方案调整,包括权限配置、白名单配置和action配置三种方式,并提供了相应的Java和Kotl... 目录前言实现方案         方案概述一、 androidManifest 三种配置方式

Python解析器安装指南分享(Mac/Windows/Linux)

《Python解析器安装指南分享(Mac/Windows/Linux)》:本文主要介绍Python解析器安装指南(Mac/Windows/Linux),具有很好的参考价值,希望对大家有所帮助,如有... 目NMNkN录1js. 安装包下载1.1 python 下载官网2.核心安装方式3. MACOS 系统安