kubesphere / kubekey

Install Kubernetes/K3s only, both Kubernetes/K3s and KubeSphere, and related cloud-native add-ons, it supports all-in-one, multi-node, and HA 🔥 ⎈ 🐳
https://kubesphere.io
Apache License 2.0
2.37k stars 552 forks source link

离线部署k8s时,使用自己部署的harbor,无法部署成功 #1846

Open FumingD opened 1 year ago

FumingD commented 1 year ago

What is version of KubeKey has the issue?

3.0.7

What is your os environment?

centos 7.9

KubeKey config file

apiVersion: kubekey.kubesphere.io/v1alpha2

kind: Cluster

metadata:

  name: sample

spec:

  hosts:

  - {name: master1, address: 192.168.0.3, internalAddress: 192.168.0.3, user: root, password: "<REPLACE_WITH_YOUR_ACTUAL_PASSWORD>"}
  - {name: master2, address: 192.168.0.4, internalAddress: 192.168.0.4, user: root, password: "<REPLACE_WITH_YOUR_ACTUAL_PASSWORD>"}
  - {name: master2, address: 192.168.0.6, internalAddress: 192.168.0.6, user: root, password: "<REPLACE_WITH_YOUR_ACTUAL_PASSWORD>"}

  - {name: node1, address: 192.168.0.5, internalAddress: 192.168.0.5, user: root, password: "<REPLACE_WITH_YOUR_ACTUAL_PASSWORD>"}

  roleGroups:

    etcd:

    - master1
    - master2
    - master3
    control-plane:
    - master1
    - master2
    - master3

    worker:

    - node1

    # 如需使用 kk 自动部署镜像仓库,请设置该主机组 (建议仓库与集群分离部署,减少相互影响)

    registry:

    - node1

  controlPlaneEndpoint:

    ## Internal loadbalancer for apiservers

    # internalLoadbalancer: haproxy

    domain: lb.kubesphere.local

    address: ""

    port: 6443

  kubernetes:

    version: v1.22.12

    clusterName: cluster.local

  network:

    plugin: calico

    kubePodsCIDR: 10.233.64.0/18

    kubeServiceCIDR: 10.233.0.0/18

    ## multus support. https://github.com/k8snetworkplumbingwg/multus-cni

    multusCNI:

      enabled: false

  registry:

    # 如需使用 kk 部署 harbor, 可将该参数设置为 harbor,不设置该参数且需使用 kk 创建容器镜像仓库,将默认使用docker registry。

    type: harbor

    # 如使用 kk 部署的 harbor 或其他需要登录的仓库,可设置对应仓库的auths,如使用 kk 创建的 docker registry 仓库,则无需配置该参数。

    # 注意:如使用 kk 部署 harbor,该参数请于 harbor 启动后设置。

    auths:

     "dockerhub.kubekey.local":

       username: admin

       password: Harbor12345

    # 设置集群部署时使用的私有仓库

    privateRegistry: "dockerhub.kubekey.local"

    namespaceOverride: "kubesphereio"

    registryMirrors: []

    insecureRegistries: []

  addons: []

A clear and concise description of what happend.

离线部署在部署harbor时,因为必须得下载harbor压缩包(https://github.com/kubesphere/kubekey/issues/1845),所以换种方式,尝试用自己搭建的harbor看看那能否部署,结果依然无法成功。详细步骤如下

  1. 在一台机器上搭建离线的harbor,假设harbor服务器的ip是192.168.0.9, 搭建成功,在浏览器上输入harbor的地址(http方式),可以访问并登录harbor。
  2. 在要搭建的集群的3个master节点和worker节点,均部署docker,docker版本是20.10.8。修改hosts文件,dockerhub.kubekey.local 192.168.0.9, 修改/etc/docker/daemon.json文件,添加insecure-registries: ["dockerhub.kubekey.local", 192.168.0.9]并测试docker login dockerhub.kubekey.local, 在输入用户名和密码后可以正常login。
  3. 将离线制品,manifest, config配置文件,拷贝到离线目录。执行 ./kk create cluster -f config-sample.yaml -a kubesphere.tar.gz --with-packages,命令。开始安装,但后续报如下的错误: Login PrivateRegistry: Error Response from daemon:Get “https://dockerhub.kubekey.local/” dial TCP 192.168.0.9:443 connection refused

Relevant log output

Login PrivateRegistry:
Error Response from daemon:Get “https://dockerhub.kubekey.local/” dial TCP 192.168.0.9:443 connection refused

Additional information

No response

redscholar commented 1 year ago

Have you resolved your issues, @FumingD ? Please let me know if you have any other questions or close this issue. and You can join the developer community and discuss with everyone together.https://www.kubesphere.io/forum/