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.33k stars 547 forks source link

KKCluster registryMirrors not effective #2429

Open PungYoung opened 1 week ago

PungYoung commented 1 week ago

What is version of KubeKey has the issue?

v3.1.6

What is your os environment?

ubuntu 20.04

KubeKey config file

No response

A clear and concise description of what happend.

apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: KKCluster
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"infrastructure.cluster.x-k8s.io/v1beta1","kind":"KKCluster","metadata":{"annotations":{},"name":"capi-quickstart","namespace":"default"},"spec":{"component":{"zone":"cn"},"controlPlaneLoadBalancer":{"host":"192.168.31.136"},"nodes":{"auth":{"password":"123456","user":"yang"},"instances":[{"address":"192.168.31.136"}]},"registry":{"registryMirrors":["k8s.m.daocloud.io"]}}}
  creationTimestamp: "2024-10-02T01:10:23Z"
  finalizers:
  - kkcluster.infrastructure.cluster.x-k8s.io
  generation: 2
  labels:
    cluster.x-k8s.io/cluster-name: capi-quickstart
  name: capi-quickstart
  namespace: default
  ownerReferences:
  - apiVersion: cluster.x-k8s.io/v1beta1
    blockOwnerDeletion: true
    controller: true
    kind: Cluster
    name: capi-quickstart
    uid: a9505e97-52a3-428b-a142-ffeed807875c
  resourceVersion: "564081"
  uid: 84d71118-2cac-4d6d-907b-b1715106b1f5
spec:
  component:
    zone: cn
  controlPlaneEndpoint:
    host: 192.168.31.136
    port: 6443
  controlPlaneLoadBalancer:
    host: 192.168.31.136
  distribution: kubernetes
  nodes:
    auth:
      password: "123456"
      port: 22
      timeout: 30000000000
      user: yang
    instances:
    - address: 192.168.31.136
      arch: amd64
      auth: {}
      internalAddress: 192.168.31.136
      name: kk-instance-jb74d
      roles:
      - control-plane
      - worker
  registry:
    auth:
      certsPath: ""
      insecureSkipVerify: false
      password: ""
      plainHTTP: false
      username: ""
    namespaceOverride: ""
    privateRegistry: ""
    registryMirrors:
    - k8s.m.daocloud.io

host log:

 cat /var/log/syslog

Relevant log output

Oct 13 01:01:35 kk-instance-8wm68 kubelet[26774]: E1013 01:01:35.272791   26774 kuberuntime_sandbox.go:72] "Failed to create sandbox for pod" err="rpc error: code = DeadlineExceeded desc = failed to get sandbox image \"registry.k8s.io/pause:3.8\": failed to pull image \"registry.k8s.io/pause:3.8\": failed to pull and unpack image \"registry.k8s.io/pause:3.8\": failed to resolve reference \"registry.k8s.io/pause:3.8\": failed to do request: Head \"https://us-west2-docker.pkg.dev/v2/k8s-artifacts-prod/images/pause/manifests/3.8\": dial tcp 64.233.187.82:443: i/o timeout" pod="kube-system/kube-controller-manager-kk-instance-jb74d"
Oct 13 01:01:35 kk-instance-8wm68 kubelet[26774]: E1013 01:01:35.272807   26774 kuberuntime_manager.go:1168] "CreatePodSandbox for pod failed" err="rpc error: code = DeadlineExceeded desc = failed to get sandbox image \"registry.k8s.io/pause:3.8\": failed to pull image \"registry.k8s.io/pause:3.8\": failed to pull and unpack image \"registry.k8s.io/pause:3.8\": failed to resolve reference \"registry.k8s.io/pause:3.8\": failed to do request: Head \"https://us-west2-docker.pkg.dev/v2/k8s-artifacts-prod/images/pause/manifests/3.8\": dial tcp 64.233.187.82:443: i/o timeout" pod="kube-system/kube-controller-manager-kk-instance-jb74d"
Oct 13 01:01:35 kk-instance-8wm68 kubelet[26774]: E1013 01:01:35.272855   26774 pod_workers.go:1301] "Error syncing pod, skipping" err="failed to \"CreatePodSandbox\" for \"kube-controller-manager-kk-instance-jb74d_kube-system(4c97f0cc993d7c98be1df8edcf429793)\" with CreatePodSandboxError: \"Failed to create sandbox for pod \\\"kube-controller-manager-kk-instance-jb74d_kube-system(4c97f0cc993d7c98be1df8edcf429793)\\\": rpc error: code = DeadlineExceeded desc = failed to get sandbox image \\\"registry.k8s.io/pause:3.8\\\": failed to pull image \\\"registry.k8s.io/pause:3.8\\\": failed to pull and unpack image \\\"registry.k8s.io/pause:3.8\\\": failed to resolve reference \\\"registry.k8s.io/pause:3.8\\\": failed to do request: Head \\\"https://us-west2-docker.pkg.dev/v2/k8s-artifacts-prod/images/pause/manifests/3.8\\\": dial tcp 64.233.187.82:443: i/o timeout\"" pod="kube-system/kube-controller-manager-kk-instance-jb74d" podUID="4c97f0cc993d7c98be1df8edcf429793"

Additional information

No response

PungYoung commented 1 week ago

I found that the kubeadmconfigs. spec.clusterConfiguration. imageRepository parameter has not been set to any value

apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfig
metadata:
  creationTimestamp: "2024-10-02T01:10:54Z"
  generation: 3
  labels:
    cluster.x-k8s.io/cluster-name: capi-quickstart
    cluster.x-k8s.io/control-plane: ""
    cluster.x-k8s.io/control-plane-name: capi-quickstart-control-plane
  name: capi-quickstart-control-plane-7chk2
  namespace: default
  ownerReferences:
  - apiVersion: cluster.x-k8s.io/v1beta1
    blockOwnerDeletion: true
    controller: true
    kind: Machine
    name: capi-quickstart-control-plane-7chk2
    uid: 7c508421-6e4f-486e-a395-e798110f2b07
  resourceVersion: "592130"
  uid: f6446a23-b68c-456e-ae4c-f5061096d1a5
spec:
  clusterConfiguration:
    apiServer: {}
    clusterName: capi-quickstart
    controlPlaneEndpoint: 192.168.31.136:6443
    controllerManager: {}
    dns: {}
    etcd: {}
    featureGates:
      ControlPlaneKubeletLocalMode: true
    kubernetesVersion: v1.31.0
    networking:
      dnsDomain: cluster.local
      podSubnet: 10.233.64.0/18
      serviceSubnet: 10.233.0.0/18
    scheduler: {}