首页 > 其他分享 >Kubernetes(K8S) kubesphere 安装

Kubernetes(K8S) kubesphere 安装

时间:2023-04-27 09:02:41浏览次数:61  
标签:kubectl Kubernetes kubesphere yaml k8smaster installer K8S root

安装KubeSphere最好的方法就是参考官方文档,而且官方文档是中文的。
官网地址:https://kubesphere.com.cn/

https://github.com/kubesphere/kubesphere/blob/master/README_zh.md
Kubernetes(K8S) kubesphere 介绍
安装提前条件:
使用 Kubeadm 部署 Kubernetes(K8S) 安装--附K8S架构图
使用 Kubeadm 部署 Kubernetes(K8S) 安装 -- 持久化存储(NFS网络存储)
Kubernetes(K8S) 安装 Metrics-Server

# 检查 K8S 版本,低版本需要升级
[root@k8smaster kubesphere]# kubectl version

image

安装

[root@k8smaster ~]# cd /opt/k8s/kubesphere
# 创建文件storageclass.yaml
[root@k8smaster kubesphere]# vi storageclass.yaml
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer 

# persistentVolumeClaim.yaml
[root@k8smaster kubesphere]# vi persistentVolumeClaim.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: local-pve
spec:
  accessModes:
     - ReadWriteOnce
  resources:
    requests:
      storage: 20Gi
  storageClassName: local-storage

# 下载核心文件(可以讯雷下载好传到 服务器)
[root@k8smaster kubesphere]# wget https://github.com/kubesphere/ks-installer/releases/download/v3.1.1/kubesphere-installer.yaml
[root@k8smaster kubesphere]# wget https://github.com/kubesphere/ks-installer/releases/download/v3.1.1/cluster-configuration.yaml
[root@k8smaster kubesphere]# ll
总用量 12
-rwxrwxrwx 1 root root 7663 4月  23 09:41 cluster-configuration.yaml
-rwxrwxrwx 1 root root 4064 4月  23 09:41 kubesphere-installer.yaml

# 安装
[root@k8smaster kubesphere]# kubectl apply -f storageclass.yaml
storageclass.storage.k8s.io/local-storage created
[root@k8smaster kubesphere]# kubectl apply -f persistentVolumeClaim.yaml
persistentvolumeclaim/local-pve created

[root@k8smaster kubesphere]# kubectl apply -f kubesphere-installer.yaml
customresourcedefinition.apiextensions.k8s.io/clusterconfigurations.installer.kubesphere.io created
namespace/kubesphere-system created
serviceaccount/ks-installer created
clusterrole.rbac.authorization.k8s.io/ks-installer created
clusterrolebinding.rbac.authorization.k8s.io/ks-installer created
deployment.apps/ks-installer created

[root@k8smaster kubesphere]# kubectl apply -f cluster-configuration.yaml
clusterconfiguration.installer.kubesphere.io/ks-installer created

#解决找不到证书的问题
[root@k8smaster kubesphere]# kubectl -n kubesphere-system create secret generic kube-etcd-client-certs  --from-file=etcd-client-ca.crt=/etc/kubernetes/pki/etcd/ca.crt  --from-file=etcd-client.crt=/etc/kubernetes/pki/apiserver-etcd-client.crt  --from-file=etcd-client.key=/etc/kubernetes/pki/apiserver-etcd-client.key
secret/kube-etcd-client-certs created


# 查看 POD 详情
[root@k8smaster kubesphere]# kubectl describe pod -n kubesphere-system
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  12m   default-scheduler  Successfully assigned kubesphere-system/ks-installer-7bd6b699df-9lnlc to k8snode1
  Normal  Pulling    12m   kubelet            Pulling image "kubesphere/ks-installer:v3.1.1"
  Normal  Pulled     11m   kubelet            Successfully pulled image "kubesphere/ks-installer:v3.1.1"
  Normal  Created    11m   kubelet            Created container installer
  Normal  Started    11m   kubelet            Started container installer
[root@k8smaster kubesphere]#

# 使用命令查看进度
[root@k8smaster kubesphere]# kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f 

image

如果出现下面错误,需要安装 storageclass、persistentVolumeClaim

TASK [preinstall : KubeSphere | Stopping if default StorageClass was not found] ***
fatal: [localhost]: FAILED! => {
    "assertion": "\"(default)\" in default_storage_class_check.stdout",
    "changed": false,
    "evaluated_to": false,
    "msg": "Default StorageClass was not found !"
}
# 删除
[root@k8smaster kubesphere]# kubectl delete -f kubesphere-installer.yaml
[root@k8smaster kubesphere]# kubectl delete -f cluster-configuration.yaml
# 安装完 storageclass  后,重新安装
[root@k8smaster kubesphere]# kubectl apply -f storageclass.yaml
[root@k8smaster kubesphere]# kubectl apply -f persistentVolumeClaim.yaml
[root@k8smaster kubesphere]# kubectl apply -f kubesphere-installer.yaml
[root@k8smaster kubesphere]# kubectl apply -f cluster-configuration.yaml

标签:kubectl,Kubernetes,kubesphere,yaml,k8smaster,installer,K8S,root
From: https://www.cnblogs.com/vipsoft/p/17345593.html

相关文章

  • k8s跨node,pod网络不通
    1.前因:客户提供的虚机:麒麟Linuxlanxin24.19.90-24.4.v2101.ky10.aarch64#K8S部署的flannel使用vxlan2.问题:部分机器pod跨node,网络不通3.分析过程:1.查看flannel、cni网络启动正常2.查看route正常3.查看防火墙,没4.tracer测试--不通5.PING通过tcpdump抓包,无响......
  • k8s中快速删除一个namespace
    我总结了2种方式,第1种并不总是有用,没用的时候可以试试第2种1.强制删除,加上--force--grace-period=0参数以kuboardns为例:kdeletenskuboard--force--grace-period=02.删除ns长时间卡住,nsstatus为terminating,可以用edit编辑ns信息,删掉finalizer行仍然以kuboardns为......
  • kubernetes 服务发现机制:环境变量和DNS
    1. 环境变量创建pod资源时,kubectl会将其所属名称空间内的每个活动的service对象以一系列环境变量的形式注入其中。但是也仅仅只是注入创建时候的资源,后面的变化它时不感知的。我有个game服务:qiteck@server:~$sudokubectlgetservice|grepgamegameNodePort......
  • Kubernetes(K8S) kubesphere 介绍
    使用Kubeadm部署Kubernetes(K8S)安装--附K8S架构图官网地址:https://kubesphere.com.cn/KubeSphere是个全栈的Kubernetes容器云PaaS解决方案KubeSphere是在目前主流容器调度平台Kubernetes之上构建的企业级分布式多租户容器平台,提供简单易用的操作界面以及向导式操作方......
  • kubeadm部署k8s 1.20.9
    3台CentOS7系统,k8s-masterip172.31.0.140、k8s-node1ip172.31.0.141、k8s-node2ip172.31.0.142在3台主机的hosts文件里添加记录:172.31.0.140   cluster-endpoint配置yum源yuminstall-yyum-utilsyum-config-manager\--add-repo\http://mirrors.aliyun.com/docker-ce......
  • kubernetes 1.27.1最新版集群部署
    kubernetes1.27.1最新版集群部署国内环境官方安装部署文档:https://kubernetes.io/zh-cn/docs/setup/production-environment/tools/kubeadm/install-kubeadm/准备云服务器首先买三台服务器。我用的阿里云服务器。三台服务器如下,然后我用的Tabby连接三台服务器。我以i-bp......
  • [问题记录]k8s集群中coredns解析失败
    目录[问题记录]k8s集群中coredns解析失败故障现象问题排查问题解析举例说明:解决方案修改ndots参数参考文档[问题记录]k8s集群中coredns解析失败故障现象在k8s集群,使用coredns提供集群内部dns服务但是在使用过程中,偶现解析公网域名失败的情况,应用内日志记录显示UnknownHost问......
  • mac os下安装k8s的kubernetes-dashboard
     需要这个的继续往下看 环境macos 12.6.2 安装dokcer https://docs.docker.com/desktop/install/mac-install/安装k8s https://blog.csdn.net/qq_20042935/article/details/124472626 <-看这位兄弟写的很详细了安装kubernetes-dashboard 1.创建命名空间 kubec......
  • k8s技巧完全版
    效率篇自动补全不想写那么长的命令每次都要打命名空间,太累了?调试篇这些好用的工具,你怎么能没有?日志你在哪!监控资源限制执行命令格式化输出Kubectl详细输出和调试集群来回copy文件网络篇修改Pod内部的/etc/hosts为什么我Ping不通svc?可以让我直接访问你吗......
  • kubernetes 使用 1
    安装1.用以下命令下载最新发行版:curl-LO"https://dl.k8s.io/release/$(curl-L-shttps://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"可以用以下方式指定版本curl-LOhttps://dl.k8s.io/release/v1.27.0/bin/linux/amd64/kubectl2.验证该可执行文件(可选步......