Rke安装不能从cluster.yml指定镜像版本拉取镜像

**RKE 版本:v1.3.19

**Docker 版本:20.10.21

**操作系统和内核: 4.19.90-52.28.v2207.ky10.x86_64

**主机类型和供应商: VirtualBox

**cluster.yml 文件:

nodes:
- address: 172.16.159.217
  port: "10022"
  internal_address: ""
  role:
  - controlplane
  - worker
  - etcd
  hostname_override: ""
  user: appuser
  ssh_key: ""
  ssh_key_path: /home/appuser/.ssh/id_rsa
  ssh_cert: ""
  ssh_cert_path: ""
  labels: {}
  taints: []
- address: 172.16.159.218
  port: "10022"
  internal_address: ""
  role:
  - controlplane
  - worker
  - etcd
  hostname_override: ""
  user: appuser
  ssh_key: ""
  ssh_key_path: /home/appuser/.ssh/id_rsa
  ssh_cert: ""
  ssh_cert_path: ""
  labels: {}
  taints: []
- address: 172.16.159.219
  port: "10022"
  internal_address: ""
  role:
  - controlplane
  - worker
  - etcd
  hostname_override: ""
  user: appuser
  ssh_key: ""
  ssh_key_path: /home/appuser/.ssh/id_rsa
  ssh_cert: ""
  ssh_cert_path: ""
  labels: {}
  taints: []
services:
  etcd:
    image: ""
    extra_args: {}
    extra_args_array: {}
    extra_binds: []
    extra_env: []
    win_extra_args: {}
    win_extra_args_array: {}
    win_extra_binds: []
    win_extra_env: []
    external_urls: []
    ca_cert: ""
    cert: ""
    key: ""
    path: ""
    uid: 0
    gid: 0
    snapshot: null
    retention: ""
    creation: ""
    backup_config: null
  kube-api:
    image: ""
    extra_args: {}
    extra_args_array: {}
    extra_binds: []
    extra_env: []
    win_extra_args: {}
    win_extra_args_array: {}
    win_extra_binds: []
    win_extra_env: []
    service_cluster_ip_range: 10.43.0.0/16
    service_node_port_range: 30000-32767
    pod_security_policy: false
    pod_security_configuration: ""
    always_pull_images: false
    secrets_encryption_config: null
    audit_log: null
    admission_configuration: null
    event_rate_limit: null
  kube-controller:
    image: ""
    extra_args: {}
    extra_args_array: {}
    extra_binds: []
    extra_env: []
    win_extra_args: {}
    win_extra_args_array: {}
    win_extra_binds: []
    win_extra_env: []
    cluster_cidr: 10.42.0.0/16
    service_cluster_ip_range: 10.43.0.0/16
  scheduler:
    image: ""
    extra_args: {}
    extra_args_array: {}
    extra_binds: []
    extra_env: []
    win_extra_args: {}
    win_extra_args_array: {}
    win_extra_binds: []
    win_extra_env: []
  kubelet:
    image: ""
    extra_args: {}
    extra_args_array: {}
    extra_binds: []
    extra_env: []
    win_extra_args: {}
    win_extra_args_array: {}
    win_extra_binds: []
    win_extra_env: []
    cluster_domain: wgq.com
    infra_container_image: ""
    cluster_dns_server: 10.43.0.10
    fail_swap_on: false
    generate_serving_certificate: false
  kubeproxy:
    image: ""
    extra_args: {}
    extra_args_array: {}
    extra_binds: []
    extra_env: []
    win_extra_args: {}
    win_extra_args_array: {}
    win_extra_binds: []
    win_extra_env: []
network:
  plugin: canal
  options: {}
  mtu: 0
  node_selector: {}
  update_strategy: null
  tolerations: []
authentication:
  strategy: x509
  sans: []
  webhook: null
addons: ""
addons_include: []
system_images:
  rancher/mirrored-coreos-etcd: v3.4.16-rancher1
  rancher/rke-tools: v0.1.78
  rancher/mirrored-k8s-dns-kube-dns: 1.17.4
  rancher/mirrored-k8s-dns-dnsmasq-nanny: 1.17.4
  rancher/mirrored-k8s-dns-sidecar: 1.17.4
  rancher/mirrored-cluster-proportional-autoscaler: 1.8.3
  rancher/mirrored-coredns-coredns: 1.8.4
  rancher/mirrored-k8s-dns-node-cache: 1.18.0
  rancher/hyperkube: v1.21.5-rancher1
  rancher/mirrored-coreos-flannel: v0.14.0
  rancher/flannel-cni: v0.3.0-rancher6
  rancher/mirrored-calico-node: v3.19.2
  rancher/calico-cni: v3.19.2
  rancher/mirrored-calico-kube-controllers: v3.19.2
  rancher/mirrored-calico-ctl: v3.19.2
  rancher/mirrored-calico-pod2daemon-flexvol: v3.19.2
  rancher/mirrored-flannelcni-flannel: v0.17.0
  weaveworks/weave-kube: 2.8.1
  weaveworks/weave-npc: 2.8.1
  rancher/mirrored-pause: 3.4.1
  rancher/nginx-ingress-controller: nginx-0.48.1-rancher1
  rancher/mirrored-nginx-ingress-controller-defaultbackend: 1.5-rancher1
  rancher/mirrored-ingress-nginx-kube-webhook-certgen: v1.1.1
  rancher/mirrored-metrics-server: v0.5.0
  noiro/cnideploy: 5.2.3.5.1d150da
  noiro/aci-containers-host: 5.2.3.5.1d150da
  noiro/opflex: 5.2.3.5.1d150da
  noiro/openvswitch: 5.2.3.5.1d150da
  noiro/aci-containers-controller: 5.2.3.5.1d150da
  noiro/gbp-server: 5.2.3.5.1d150da
  noiro/opflex-server: 5.2.3.5.1d150da
ssh_key_path: ~/.ssh/id_rsa
ssh_cert_path: ""
ssh_agent_auth: false
authorization:
  mode: rbac
  options: {}
ignore_docker_version: null
enable_cri_dockerd: null
kubernetes_version: ""
private_registries:
  - url: lj.com
    user: admin
    password: Harbor12345
    is_default: true
ingress:
  provider: ""
  options: {}
  node_selector: {}
  extra_args: {}
  dns_policy: ""
  extra_envs: []
  extra_volumes: []
  extra_volume_mounts: []
  update_strategy: null
  http_port: 0
  https_port: 0
  network_mode: ""
  tolerations: []
  default_backend: null
  default_http_backend_priority_class_name: ""
  nginx_ingress_controller_priority_class_name: ""
  default_ingress_class: null
cluster_name: ""
cloud_provider:
  name: ""
prefix_path: ""
win_prefix_path: ""
addon_job_timeout: 0
bastion_host:
  address: ""
  port: ""
  user: ""
  ssh_key: ""
  ssh_key_path: ""
  ssh_cert: ""
  ssh_cert_path: ""
  ignore_proxy_env_vars: false
monitoring:
  provider: ""
  options: {}
  node_selector: {}
  update_strategy: null
  replicas: null
  tolerations: []
  metrics_server_priority_class_name: ""
restore:
  restore: false
  snapshot_name: ""
rotate_encryption_key: false
dns: null

重现步骤:

./rke up --config ./cluster.yml

结果:
FATA[0005] [Failed to pull image [lj.com/rancher/rke-tools:v0.1.88] on host [172.16.159.218]: Error response from daemon: unknown: artifact rancher/rke-tools:v0.1.88 not found]

你这个 cluster.yml 看样子像是通过 rke config 生成的,但 system_images: 下的镜像列表明显是你手改的,不是通过 rke config 生成的……

简单来说,就是你 system_images: 下指定的镜像的格式错误导致的,正确的格式应该是:

system_images:
  etcd: rancher/mirrored-coreos-etcd:v3.5.4
  alpine: rancher/rke-tools:v0.1.88
  nginx_proxy: rancher/rke-tools:v0.1.88
  cert_downloader: rancher/rke-tools:v0.1.88
  kubernetes_services_sidecar: rancher/rke-tools:v0.1.88
  kubedns: rancher/mirrored-k8s-dns-kube-dns:1.21.1
  dnsmasq: rancher/mirrored-k8s-dns-dnsmasq-nanny:1.21.1
  kubedns_sidecar: rancher/mirrored-k8s-dns-sidecar:1.21.1
  kubedns_autoscaler: rancher/mirrored-cluster-proportional-autoscaler:1.8.5
  coredns: rancher/mirrored-coredns-coredns:1.9.3
  coredns_autoscaler: rancher/mirrored-cluster-proportional-autoscaler:1.8.5
  nodelocal: rancher/mirrored-k8s-dns-node-cache:1.21.1
  kubernetes: rancher/hyperkube:v1.24.10-rancher4
  flannel: rancher/mirrored-coreos-flannel:v0.15.1
  flannel_cni: rancher/flannel-cni:v0.3.0-rancher6
  calico_node: rancher/mirrored-calico-node:v3.22.5
  calico_cni: rancher/calico-cni:v3.22.5-rancher1
  calico_controllers: rancher/mirrored-calico-kube-controllers:v3.22.5
  calico_ctl: rancher/mirrored-calico-ctl:v3.22.5
  calico_flexvol: rancher/mirrored-calico-pod2daemon-flexvol:v3.22.5
  canal_node: rancher/mirrored-calico-node:v3.22.5
  canal_cni: rancher/calico-cni:v3.22.5-rancher1
  canal_controllers: rancher/mirrored-calico-kube-controllers:v3.22.5
  canal_flannel: rancher/mirrored-flannelcni-flannel:v0.17.0
  canal_flexvol: rancher/mirrored-calico-pod2daemon-flexvol:v3.22.5
  weave_node: weaveworks/weave-kube:2.8.1
  weave_cni: weaveworks/weave-npc:2.8.1
  pod_infra_container: rancher/mirrored-pause:3.6
  ingress: rancher/nginx-ingress-controller:nginx-1.5.1-rancher2
  ingress_backend: rancher/mirrored-nginx-ingress-controller-defaultbackend:1.5-rancher1
  ingress_webhook: rancher/mirrored-ingress-nginx-kube-webhook-certgen:v1.1.1
  metrics_server: rancher/mirrored-metrics-server:v0.6.2
  windows_pod_infra_container: rancher/mirrored-pause:3.6
  aci_cni_deploy_container: noiro/cnideploy:5.2.3.5.1d150da
  aci_host_container: noiro/aci-containers-host:5.2.3.5.1d150da
  aci_opflex_container: noiro/opflex:5.2.3.5.1d150da
  aci_mcast_container: noiro/opflex:5.2.3.5.1d150da
  aci_ovs_container: noiro/openvswitch:5.2.3.5.1d150da
  aci_controller_container: noiro/aci-containers-controller:5.2.3.5.1d150da
  aci_gbp_server_container: noiro/gbp-server:5.2.3.5.1d150da
  aci_opflex_server_container: noiro/opflex-server:5.2.3.5.1d150da

另外,不建议修改默认的镜像版本号,可能会导致组件不兼容的情况,如果你想指定K8s 版本,可使用 kubernetes_version 参数。

好的,谢谢,我再试试