KubeSphere v3.4.0 部署K8S Docker + Prometheus + grafana

KubeSphere v3.4.0 部署K8S

  • 1、整体思路
  • 2、修改linux主机名
  • 3、 离线安装
    • 3.1 问题列表
    • 3.2 执行命令成功列表

1、整体思路

  • 将KubeSphere v3.4.0 安装包传输到其中一台机器
  • 修改Linux主机名(选取3台,修改为master01、master02、master03)
  • 安装官方文档安装

2、修改linux主机名

背景:一共7台机器,3台作为master,4台作为node

# 查看当前主机名
hostname
# 修改主机名
hostnamectl set-hostname master01
hostnamectl set-hostname node01

分别进入3台 master机器,修改主机名为master01、master02、master03
分别进入4从节点台机,修改主机名为noder01、node02、node03

3、 离线安装

参考地址:https://www.kubesphere.io/zh/docs/v3.4/installing-on-linux/introduction/air-gapped-installation/

3.1 问题列表

  • 问题1:不支持版本
    在这里插入图片描述
    ** kubesphere 3.3.1对应 kubernetes版本是1.22.12**
  • 重要:registry 的type 设置成 harbor;address 和 internalAddress 设置成同样的ip
    KubeSphere v3.4.0 部署K8S Docker + Prometheus + grafana_第1张图片
    问题2: 需要设置对应ip的用户名密码
    KubeSphere v3.4.0 部署K8S Docker + Prometheus + grafana_第2张图片
    问题3: 创建harbor 提示 “未授权”
    KubeSphere v3.4.0 部署K8S Docker + Prometheus + grafana_第3张图片
    解决:
    在config-sample.yaml 修改如下:
  ...

  registry:

    type: harbor

    auths:

      "dockerhub.kubekey.local":

        username: admin

        password: Harbor12345

    privateRegistry: "dockerhub.kubekey.local"

    namespaceOverride: "kubesphereio"

    registryMirrors: []

    insecureRegistries: []

  addons: []

重要: 密码不能变,必须是Harbor12345

3.2 执行命令成功列表

  • 将下载的 KubeKey 和制品 artifact 通过 U 盘等介质拷贝至离线环境安装节点。
  • 执行以下命令创建离线集群配置文件:
./kk create config --with-kubesphere v3.3.1 --with-kubernetes v1.23.15 -f config-sample.yaml

在这里插入图片描述
修改 config-sample.yaml 文件,3个master,4个node。kubernetes版本改为1.22.12.

  • 执行以下命令安装镜像仓库
./kk init registry -f config-sample.yaml -a kubesphere.tar.gz

KubeSphere v3.4.0 部署K8S Docker + Prometheus + grafana_第4张图片

  • 创建 Harbor 项目。
vim create_project_harbor.sh

在harbor_projects 的 library 中添加自己的代码仓库,如testTeam

#!/usr/bin/env bash

url="https://dockerhub.kubekey.local"  #修改url的值为https://dockerhub.kubekey.local

user="admin"

passwd="Harbor12345"



harbor_projects=(library

   kubesphereio

   kubesphere

   argoproj

   calico

   coredns

   openebs

   csiplugin

   minio

   mirrorgooglecontainers

   osixia

   prom

   thanosio

   jimmidyson

   grafana

   elastic

   istio

   jaegertracing

   jenkins

   weaveworks

   openpitrix

   joosthofman

   nginxdemos

   fluent

   kubeedge

   openpolicyagent
   
   testTeam

)



for project in "${harbor_projects[@]}"; do

   echo "creating $project"

   curl -u "${user}:${passwd}" -X POST -H "Content-Type: application/json" "${url}/api/v2.0/projects" -d "{ \"project_name\": \"${project}\", \"public\": true}" -k #curl命令末尾加上 -k

done

执行创建Harbor脚本

./create_project_harbor.sh

结果:
KubeSphere v3.4.0 部署K8S Docker + Prometheus + grafana_第5张图片

  • 执行以下命令安装 KubeSphere 集群

KubeSphere v3.4.0 部署K8S Docker + Prometheus + grafana_第6张图片

  • 执行以下命令查看集群状态
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l 'app in (ks-install, ks-installer)' -o jsonpath='{.items[0].metadata.name}') -f

KubeSphere v3.4.0 部署K8S Docker + Prometheus + grafana_第7张图片
访问界面:
KubeSphere v3.4.0 部署K8S Docker + Prometheus + grafana_第8张图片

你可能感兴趣的:(kubernetes,docker,prometheus)