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.18k stars 518 forks source link

kubekey provider v3.0.13 install cluster faild #2282

Open abrahamhwj opened 3 weeks ago

abrahamhwj commented 3 weeks ago

What is version of KubeKey has the issue?

infrastructure kubekey v3.0.13

What is your os environment?

centos 7.9

KubeKey config file

# kk cluster config file
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
  name: kk-cluster
  namespace: default
spec:
  clusterNetwork:
    pods:
      cidrBlocks:
      - 10.233.64.0/18
    serviceDomain: cluster.local
    services:
      cidrBlocks:
      - 10.233.0.0/18
  controlPlaneRef:
    apiVersion: controlplane.cluster.x-k8s.io/v1beta1
    kind: KubeadmControlPlane
    name: kk-cluster-control-plane
  infrastructureRef:
    apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
    kind: KKCluster
    name: kk-cluster
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: KKCluster
metadata:
  name: kk-cluster
  namespace: default
spec:
  component:
    zone: ""
  controlPlaneLoadBalancer:
    host: 192.168.3.210
  nodes:
    auth:
      password: hwj5965339
      user: root
    instances:
    - address: "192.168.3.211"
    - address: "192.168.3.212"
---
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlane
metadata:
  name: kk-cluster-control-plane
  namespace: default
spec:
  kubeadmConfigSpec:
    files:
    - content: |
        apiVersion: v1
        kind: Pod
        metadata:
          name: kube-vip
          namespace: kube-system
        spec:
          containers:
          - args:
            - manager
            env:
            - name: address
              value: 192.168.3.210
            - name: vip_interface
              value: ""
            - name: vip_arp
              value: "true"
            - name: port
              value: "6443"
            - name: vip_cidr
              value: "32"
            - name: cp_enable
              value: "true"
            - name: cp_namespace
              value: kube-system
            - name: vip_ddns
              value: "false"
            - name: svc_enable
              value: "true"
            - name: vip_leaderelection
              value: "true"
            - name: vip_leaseduration
              value: "5"
            - name: vip_renewdeadline
              value: "3"
            - name: vip_retryperiod
              value: "1"
            - name: lb_enable
              value: "true"
            - name: lb_port
              value: "6443"
            image: ghcr.io/kube-vip/kube-vip:v0.5.0
            imagePullPolicy: IfNotPresent
            name: kube-vip
            resources: {}
            securityContext:
              capabilities:
                add:
                - NET_ADMIN
                - NET_RAW
            volumeMounts:
            - mountPath: /etc/kubernetes/admin.conf
              name: kubeconfig
          hostNetwork: true
          hostAliases:
            - hostnames:
                - kubernetes
              ip: 127.0.0.1
          volumes:
          - hostPath:
              path: /etc/kubernetes/admin.conf
              type: FileOrCreate
            name: kubeconfig
        status: {}
      owner: root:root
      path: /etc/kubernetes/manifests/kube-vip.yaml
    initConfiguration:
      nodeRegistration:
        criSocket: unix:///var/run/containerd/containerd.sock
    joinConfiguration:
      nodeRegistration:
        criSocket: unix:///var/run/containerd/containerd.sock
  machineTemplate:
    infrastructureRef:
      apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
      kind: KKMachineTemplate
      name: kk-cluster-control-plane
  replicas: 1
  version: v1.23.10
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: KKMachineTemplate
metadata:
  name: kk-cluster-control-plane
  namespace: default
spec:
  template:
    spec:
      repository:
        iso: none
        update: false
      roles:
      - control-plane
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
  name: kk-cluster-md-0
  namespace: default
spec:
  clusterName: kk-cluster
  replicas: 0
  selector:
    matchLabels: null
  template:
    spec:
      bootstrap:
        configRef:
          apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
          kind: KubeadmConfigTemplate
          name: kk-cluster-md-0
      clusterName: kk-cluster
      infrastructureRef:
        apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
        kind: KKMachineTemplate
        name: kk-cluster-md-0
      version: v1.23.10
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: KKMachineTemplate
metadata:
  name: kk-cluster-md-0
  namespace: default
spec:
  template:
    spec:
      repository:
        iso: none
        update: false
      roles:
      - worker
---
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
metadata:
  name: kk-cluster-md-0
  namespace: default
spec:
  template:
    spec:
      joinConfiguration:
        nodeRegistration:
          criSocket: unix:///var/run/containerd/containerd.sock

A clear and concise description of what happend.

1、Using clusterctl init --infrastructure kubekey:v3.1.1 results in an error indicating that the specified version cannot be found, and when no version is specified, it defaults to installing version 3.0.13. 2、When installing the cluster using version 3.0.13, failed with error:crictl not found in system path 3、Log in to the target virtual machine and confirm that crictl exists in the $PATH(/usr/local/bin) directory, and crictl can be executed normally.

Relevant log output

E0610 15:22:46.531500       1 kkinstance_controller.go:382]  "msg"="failed to reconcile phase" "error"="failed to run cloud config: [init] Using Kubernetes version: v1.23.10\r\n[preflight] Running pre-flight checks\r\n[preflight] WARNING: Couldn't create the interface used for talking to the container runtime: crictl i │
│ s required for container runtime: exec: \"crictl\": executable file not found in $PATH\r\n\t[WARNING FileExisting-crictl]: crictl not found in system path\r\n[preflight] Pulling images required for setting up a Kubernetes cluster\r\n[preflight] This might take a minute or two, depending on the speed of your internet co │
│ nnection\r\n[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'\r\nerror execution phase preflight: crictl is required for container runtime: exec: \"crictl\": executable file not found in $PATH\r\nTo see the stack trace of this error execute with --v=5 or higher: Process exite │
│ d with status 1" "cluster"="kk-cluster" "controller"="kkinstance" "controllerGroup"="infrastructure.cluster.x-k8s.io" "controllerKind"="KKInstance" "kKInstance"={"name":"kk-instance-v68bd","namespace":"default"} "kkMachine"="kk-cluster-control-plane-tmtcx" "machine"="kk-cluster-control-plane-tmtcx" "name"="kk-instance- │
│ v68bd" "namespace"="default" "reconcileID"="5aa533ad-169e-4d85-bf77-b8966df38e3d"                                                                                                                                                                                                                                                │
│ E0610 15:22:46.531845       1 controller.go:326]  "msg"="Reconciler error" "error"="failed to run cloud config: [init] Using Kubernetes version: v1.23.10\r\n[preflight] Running pre-flight checks\r\n[preflight] WARNING: Couldn't create the interface used for talking to the container runtime: crictl is required for conta │
│ iner runtime: exec: \"crictl\": executable file not found in $PATH\r\n\t[WARNING FileExisting-crictl]: crictl not found in system path\r\n[preflight] Pulling images required for setting up a Kubernetes cluster\r\n[preflight] This might take a minute or two, depending on the speed of your internet connection\r\n[preflig │
│ ht] You can also perform this action in beforehand using 'kubeadm config images pull'\r\nerror execution phase preflight: crictl is required for container runtime: exec: \"crictl\": executable file not found in $PATH\r\nTo see the stack trace of this error execute with --v=5 or higher: Process exited with status 1" "co │
│ ntroller"="kkinstance" "controllerGroup"="infrastructure.cluster.x-k8s.io" "controllerKind"="KKInstance" "kKInstance"={"name":"kk-instance-v68bd","namespace":"default"} "name"="kk-instance-v68bd" "namespace"="default" "reconcileID"="5aa533ad-169e-4d85-bf77-b8966df38e3d"                                                   │

Additional information

Clusterctl Version 1.7.2 ps: why clusterctl only support kubekey v3.0.13