Skip to content

kk4.0.1版本 使用离线包部署失败 #2864

@wffeige

Description

@wffeige

What is version of KubeKey has the issue?

./kk artifact images -i inventory.yaml -c config.yaml -a /data/maas/install/k8s/kubekey/kubekey_offline_v1.28.15.tgz -v 5

What is your os environment?

Ubuntu 22.04 x86

KubeKey config file

apiVersion: kubekey.kubesphere.io/v1
kind: Config
spec:
  download:
    # if set as "cn", so that online downloads will try to use available domestic sources whenever possible.
    zone: "cn"
    cn_host: kubekey.pek3b.qingstor.com
    arch: [ "amd64" ] # 指定arm64或者amd64
  kubernetes:
    kube_version: v1.28.15
    # helm binary
    helm_version: v3.12.1
  etcd:
    # etcd binary
    etcd_version: v3.5.9
    dockerio_registry: "docker.1ms.run"
    ghcrio_registry: "docker.1ms.run"
    quayio_registry: "docker.1ms.run"
  image_registry:
    # ========== image registry ==========
    # keepalived image tag. Used for load balancing when there are multiple image registry nodes.
    keepalived_version: 2.0.20
    # ========== image registry: harbor ==========
    # harbor image tag
    harbor_version: v2.10.1
    # docker-compose binary
    dockercompose_version: v2.20.3
    # ========== image registry: docker-registry ==========
    # docker-registry image tag
    docker_registry_version: 2.8.3
    dockerio_registry: "docker.1ms.run"
    ghcrio_registry: "docker.1ms.run"
    quayio_registry: "docker.1ms.run"
  cri:
    # support: containerd,docker
    container_manager: containerd
    sandbox_image:
      tag: "3.8"
    # ========== cri ==========
    # crictl binary
    crictl_version: v1.28.0
    # ========== cri: docker ==========
    # docker binary
    docker_version: 24.0.6
    # cridockerd. Required when kube_version is greater than 1.24
    cridockerd_version: v0.3.1
    # ========== cri: containerd ==========
    # containerd binary
    containerd_version: v1.7.3
    # runc binary
    runc_version: v1.1.7
    dockerio_registry: "docker.1ms.run"
    ghcrio_registry: "docker.1ms.run"
    quayio_registry: "docker.1ms.run"
  cni:
    multus:
      image:
        tag: v4.1.0
    # ========== cni ==========
    # cni_plugins binary (optional)
    # cni_plugins_version: v1.2.0
    # ========== cni: calico ==========
    # calicoctl binary
    calico_version: v3.28.2
    # ========== cni: cilium ==========
    # cilium helm
    cilium_version: 1.16.16
    # ========== cni: kubeovn ==========
    # kubeovn helm
    kubeovn_version: 1.12.0
    # ========== cni: hybridnet ==========
    # hybridnet helm
    hybridnet_version: 0.6.8
    dockerio_registry: "docker.1ms.run"
    ghcrio_registry: "docker.1ms.run"
    quayio_registry: "docker.1ms.run"
  storage_class:
    # ========== storageclass ==========
    # ========== storageclass: local ==========
    local:
      provisioner_image:
        tag: 3.4.0
      linux_utils_image:
        tag: 3.4.0
    # ========== storageclass: nfs ==========
    # nfs provisioner helm version
    nfs_provisioner_version: 4.0.10
  dns:
    dns_image:
      tag: v1.10.1
    dns_cache_image:
      tag: 1.22.20
  image_manifests:
    - docker.1ms.run/calico/apiserver:v3.28.2
    - docker.1ms.run/calico/cni:v3.28.2
    - docker.1ms.run/calico/ctl:v3.28.2
    - docker.1ms.run/calico/csi:v3.28.2
    - docker.1ms.run/calico/kube-controllers:v3.28.2
    - docker.1ms.run/calico/node-driver-registrar:v3.28.2
    - docker.1ms.run/calico/node:v3.28.2
    - docker.1ms.run/calico/pod2daemon-flexvol:v3.28.2
    - docker.1ms.run/calico/typha:v3.28.2
    - docker.1ms.run/kubesphere/coredns:v1.10.1
    - docker.1ms.run/kubesphere/k8s-dns-node-cache:1.22.20
    - docker.1ms.run/kubesphere/kube-apiserver:v1.28.15
    - docker.1ms.run/kubesphere/kube-controller-manager:v1.28.15
    - docker.1ms.run/kubesphere/kube-proxy:v1.28.15
    - docker.1ms.run/kubesphere/kube-scheduler:v1.28.15
    - docker.1ms.run/kubesphere/pause:3.8
    - docker.1ms.run/openebs/linux-utils:3.4.0
    - docker.1ms.run/openebs/provisioner-localpv:3.4.0
    - quay.nju.edu.cn/tigera/operator:v1.34.5

A clear and concise description of what happend.

背景:
调研kk 离线安装k8s方案

操作步骤
step1 打离线包命令【成功】
kk artifact export -i inventory.yaml -c config.yaml -v 8 -a /data/maas/install/k8s/kubekey/kubekey_offline_v1.28.15.tgz

注意 config.yaml 文件直接copy的官方示例文件 https://github.com/kubesphere/kubekey/blob/main/builtin/core/defaults/config/v1.28.yaml

step2 导入离线包命令【报错】
./kk artifact images -i inventory.yaml -c config.yaml -a /data/maas/install/k8s/kubekey/kubekey_offline_v1.28.15.tgz

出现报错
⠋ [localhost] failed [0s]
I1120 14:09:58.921129 47975 task_executor.go:105] "end run task" task="default/artifact-images-r59jg-x4q8l"
14:09:58 CST [Playbook default/artifact-images-r59jg] finish. total: 12,success: 11,ignored: 0,failed: 1
Error: task Defaults | Select the initialization node for the cluster run failed:
[localhost]: failed to add_hostvars: failed to add_hostvars: failed to execute template '{{- $initNodes := list -}} {{- $notInitNodes := list -}} {{- range .groups.kube_control_plane -}}
{{- if index $.hostvars . "kubernetes_install_LoadState" "stdout" | eq "loaded" -}}
{{- $initNodes = append $initNodes . -}}
{{- else if index $.hostvars . "kubernetes_install_LoadState" "stdout" | eq "not-found" -}}
{{- $notInitNodes = append $notInitNodes . -}}
{{- end -}}
{{- end -}} {{- if $initNodes | len | eq 1 -}} {{ $initNodes | first }} {{- else if $initNodes | len | lt 1 -}} {{ index $initNodes (randInt 0 ((sub ($initNodes | len) 1) | int)) }} {{- else if $notInitNodes | len | eq 1 -}} {{ $notInitNodes | first }} {{- else if $notInitNodes | len | lt 1 -}} {{ index $notInitNodes (randInt 0 ((sub ($notInitNodes | len) 1) | int)) }} {{- end -}}': template: kubekey:2:9: executing "kubekey" at <index $.hostvars . "kubernetes_install_LoadState" "stdout">: error calling index: index of nil pointer

task Defaults | Select the initialization node for the cluster run failed:
[localhost]: failed to add_hostvars: failed to add_hostvars: failed to execute template '{{- $initNodes := list -}} {{- $notInitNodes := list -}} {{- range .groups.kube_control_plane -}}
{{- if index $.hostvars . "kubernetes_install_LoadState" "stdout" | eq "loaded" -}}
{{- $initNodes = append $initNodes . -}}
{{- else if index $.hostvars . "kubernetes_install_LoadState" "stdout" | eq "not-found" -}}
{{- $notInitNodes = append $notInitNodes . -}}
{{- end -}}
{{- end -}} {{- if $initNodes | len | eq 1 -}} {{ $initNodes | first }} {{- else if $initNodes | len | lt 1 -}} {{ index $initNodes (randInt 0 ((sub ($initNodes | len) 1) | int)) }} {{- else if $notInitNodes | len | eq 1 -}} {{ $notInitNodes | first }} {{- else if $notInitNodes | len | lt 1 -}} {{ index $notInitNodes (randInt 0 ((sub ($notInitNodes | len) 1) | int)) }} {{- end -}}': template: kubekey:2:9: executing "kubekey" at <index $.hostvars . "kubernetes_install_LoadState" "stdout">: error calling inde

Relevant log output

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions