k8s 拉取镜像失败_kubernetes k8s.gcr.io拉取镜像失败问题

本文介绍了如何解决kubeadm init过程中由于k8s.gcr.io仓库在国内被屏蔽导致的拉取镜像失败问题。通过使用`kubeadm init`命令的`--image-repository`参数,可以指定替代的镜像仓库,例如`imdingtalk`,以成功初始化k8s集群。
摘要由CSDN通过智能技术生成

kubeadm init默认用的是k8s.gcr.io这个仓库,由于国内被屏蔽了

搜了很多文章都是用脚本去解决,这个太繁琐了。

最后kubeadm init --help看了一下,发现其实可以指定image的仓库。

Flags:

--apiserver-advertise-address string The IP address the API Server will advertise it's listening on. If not set the default network interface will be used.

--apiserver-bind-port int32 Port for the API Server to bind to. (default 6443)

--apiserver-cert-extra-sans strings Optional extra Subject Alternative Names (SANs) to use for the API Server serving certificate. Can be both IP addresses and DNS names.

--cert-dir string The path where to save and store the certificates. (default "/etc/kubernetes/pki")

--certificate-key string Key used to encrypt the control-plane certificates in the kubeadm-certs Secret.

--config string Path to a kubeadm configuration file.

--control-plane-endpoint string Specify a stable IP address or DNS name for the control plane.

--cri-socket string Path to the CRI socket to connect. If empty kubeadm will try to auto-detect this value; use this option only if you have more than one CRI installed or if you have non-standard CRI socket.

--dry-run Don't apply any changes; just output what would be done.

-k, --experimental-kustomize string The path where kustomize patches for static pod manifests are stored.

--feature-gates string A set of key=value pairs that describe feature gates for various features. Options are:

IPv6DualStack=true|false (ALPHA - default=false)

-h, --help help for init

--ignore-preflight-errors strings A list of checks whose errors will be shown as warnings. Example: 'IsPrivilegedUser,Swap'. Value 'all' ignores errors from all checks.

--image-repository string Choose a container registry to pull control plane images from (default "k8s.gcr.io")

--kubernetes-version string Choose a specific Kubernetes version for the control plane. (default "stable-1")

--node-name string Specify the node name.

--pod-network-cidr string Specify range of IP addresses for the pod network. If set, the control plane will automatically allocate CIDRs for every node.

--service-cidr string Use alternative range of IP address for service VIPs. (default "10.96.0.0/12")

--service-dns-domain string Use alternative domain for services, e.g. "myorg.internal". (default "cluster.local")

--skip-certificate-key-print Don't print the key used to encrypt the control-plane certificates.

--skip-phases strings List of phases to be skipped

--skip-token-print Skip printing of the default bootstrap token generated by 'kubeadm init'.

--token string The token to use for establishing bidirectional trust between nodes and control-plane nodes. The format is [a-z0-9]{6}\.[a-z0-9]{16} - e.g. abcdef.0123456789abcdef

--token-ttl duration The duration before the token is automatically deleted (e.g. 1s, 2m, 3h). If set to '0', the token will never expire (default 24h0m0s)

--upload-certs Upload control-plane certificates to the kubeadm-certs Secret.

只要执行的时候加上参数就可以了。

kubeadm init --image-repository="imdingtalk" --v=8

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值