KubeKey 安装kubernetes 和 kubesphere

2023-12-26 21:28:11

在这里插入图片描述
KubeKey 可以将 Kubernetes 和 KubeSphere 一同安装。针对不同的 Kubernetes 版本,需要安装的依赖项可能有所不同。您可以参考以下列表,查看是否需要提前在节点上安装相关的依赖项。
在这里插入图片描述
如果不安装
socat ,conntrack 运行时会提示报错

10:59:52 CST [ERRO] iZ8vb0i5txp0l737b52v40Z: conntrack is required.
10:59:52 CST [ERRO] iZ8vb0i5txp0l737b52v40Z: socat is required.

先安装conntrack

yum install conntrack-tools-1.4.4-7.el7.x86_64

是否安装成功

conntrack --version
conntrack v1.4.4 (conntrack-tools)

先安装socat

 yum install socat
socat -V

安装 ebtables
查看是否安装

 ebtables -V

安装ipset
查看是否安装

ipset -V
ipset v6.38, protocol version: 6

安装

./kk create cluster --with-kubernetes v1.22.12 --with-kubesphere v3.4.1

确定 yes
在这里插入图片描述

使用该命令查看发现有两个pod没启起来,在网上找到相关的解决办法

kubectl get pods -n kube-system

在这里插入图片描述
解决办法

  1. 打开并编辑 coredns的configmap
kubectl edit cm coredns -n kube-system

  1. 删除 loop 保存并退出
    在这里插入图片描述
    删除掉那个 loop 并保存退出

  2. 重启 coredns pods:

  kubectl delete pod coredns-xxx-xxxx     -n kube-system

删除pod

kubectl delete pod coredns-5495dd7c88-2wn2c     -n kube-system
kubectl delete pod coredns-5495dd7c88-l2kwk     -n kube-system

注意:上面的解决方法并没有解决coredns pod 问题

查看该pod信息

kubectl describe pods coredns-5495dd7c88-bhs7w  -n kube-system

结果:

Name:                 coredns-5495dd7c88-bhs7w
Namespace:            kube-system
Priority:             2000000000
Priority Class Name:  system-cluster-critical
Node:                 <none>
Labels:               k8s-app=kube-dns
                      pod-template-hash=5495dd7c88
Annotations:          <none>
Status:               Pending
IP:                   
IPs:                  <none>
Controlled By:        ReplicaSet/coredns-5495dd7c88
Containers:
  coredns:
    Image:       registry.cn-beijing.aliyuncs.com/kubesphereio/coredns:1.8.0
    Ports:       53/UDP, 53/TCP, 9153/TCP
    Host Ports:  0/UDP, 0/TCP, 0/TCP
    Args:
      -conf
      /etc/coredns/Corefile
    Limits:
      memory:  170Mi
    Requests:
      cpu:        100m
      memory:     70Mi
    Liveness:     http-get http://:8080/health delay=60s timeout=5s period=10s #success=1 #failure=5
    Readiness:    http-get http://:8181/ready delay=0s timeout=1s period=10s #success=1 #failure=3
    Environment:  <none>
    Mounts:
      /etc/coredns from config-volume (ro)
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-rwrxs (ro)
Conditions:
  Type           Status
  PodScheduled   False 
Volumes:
  config-volume:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      coredns
    Optional:  false
  kube-api-access-rwrxs:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   Burstable
Node-Selectors:              kubernetes.io/os=linux
Tolerations:                 CriticalAddonsOnly op=Exists
                             node-role.kubernetes.io/control-plane:NoSchedule
                             node-role.kubernetes.io/master:NoSchedule
                             node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason            Age                 From               Message
  ----     ------            ----                ----               -------
  Warning  FailedScheduling  38s (x28 over 27m)  default-scheduler  0/1 nodes are available: 1 node(s) had taint {node.kubernetes.io/not-ready: }, that the pod didn't tolerate.

查看节点状态原因

下面的命令和上面的一样

kubectl -n <namespace> describe pod <pod-name>

kubectl -n kube-system describe pod coredns-5495dd7c88-bhs7w

也可以查看日记

kubectl logs <pod-name> -n <namespace> --previous

这个命令打印前一个容器的错误消息

解决办法:
https://blog.csdn.net/fgsdgsdghdsfgrd/article/details/131894066

文章来源:https://blog.csdn.net/xxpxxpoo8/article/details/135217378
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。