[转帖]k8s国内镜像

k8s国内镜像

https://www.jianshu.com/p/b9fecdb5e3a7

wu_sphinx 关注

2019.05.06 20:43* 字数 155 阅读 628评论 0喜欢 0

最近折腾k8s,使用kubeadm部署集群,遇到镜像下载的问题

$ kubeadm config images list
k8s.gcr.io/kube-apiserver:v1.14.1
k8s.gcr.io/kube-controller-manager:v1.14.1
k8s.gcr.io/kube-scheduler:v1.14.1
k8s.gcr.io/kube-proxy:v1.14.1
k8s.gcr.io/pause:3.1
k8s.gcr.io/etcd:3.3.10
k8s.gcr.io/coredns:1.3.1

由于一些众所周知的原因,国内是不太容易下载k8s.gcr.io站点的镜像的,偶然发现微软做了一个k8s的镜像站点,真香

global proxy in China
dockerhub (docker.io) dockerhub.azk8s.cn
gcr.io

k8s.gcr.io

gcr.azk8s.cn

gcr.azk8s.cn/google-containers

quay.io quay.azk8s.cn

注意,因为k8s.gcr.io会重定向到gcr.io/google-containers,因此比如安装k8s所必须的镜像如 k8s.gcr.io/pause:3.1
需要替换成 gcr.azk8s.cn/google-containers/pause:3.1
已经使用超过一周,非常稳定。

  • https://github.com/Azure/container-service-for-azure-china/blob/master/aks/README.md
  • 官网介绍
  • Container Registry

    2.1 Azure Container Registry(ACR)

    Azure Container Registry(ACR) provides storage of private Docker container images, enabling fast, scalable retrieval, and network-close deployment of container workloads on Azure.

    • ACR does not provide public anonymous access functionality on Azure China, this feature is in public preview on global Azure.
    • AKS has good integration with ACR, container image stored in ACR could be pulled in AKS after Configure ACR authentication.

    2.2 Container Registry Proxy

    Since some well known container registries like docker.iogcr.io are not accessible or very slow in China, we have set up container registry proxies on Azure China for public anonymous access:

    The first docker pull of new image will be still slow, and then image would be cached, would be much faster in the next docker pull action.

    global proxy in China format example
    dockerhub(docker.io) dockerhub.azk8s.cn dockerhub.azk8s.cn/<repo-name>/<image-name>:<version> dockerhub.azk8s.cn/microsoft/azure-cli:2.0.61dockerhub.azk8s.cn/library/nginx:1.15
    gcr.io gcr.azk8s.cn gcr.azk8s.cn/<repo-name>/<image-name>:<version> gcr.azk8s.cn/google_containers/hyperkube-amd64:v1.13.5
    quay.io quay.azk8s.cn quay.azk8s.cn/<repo-name>/<image-name>:<version> quay.azk8s.cn/deis/go-dev:v1.10.0

    Note: k8s.gcr.io would redirect to gcr.io/google-containers, following image urls are identical:

    k8s.gcr.io/pause-amd64:3.1
    gcr.io/google_containers/pause-amd64:3.1
    
    • Container Registry Proxy Example

      specify defaultBackend.image.repository as gcr.azk8s.cn/google_containers/defaultbackend in nginx-ingress chart since original k8s.gcr.io does not work in Azure China:

      helm install stable/nginx-ingress --set defaultBackend.image.repository=gcr.azk8s.cn/google_containers/defaultbackend --set defaultBackend.image.tag=1.4
      

    3. Install kubectl

    az aks install-cli command is used to download kubectl binary, it works on Azure China from version 2.0.61 or later, another alternative is use following command to download kubectl if don‘t have azure-cli:

    # docker run -v ${HOME}:/root -v /usr/local/bin/:/kube -it dockerhub.azk8s.cn/microsoft/azure-cli:2.0.61
    [email protected]:/# az cloud set --name AzureChinaCloud
    [email protected]:/# az aks install-cli --install-location /kube/kubectl

    run sudo az aks install-cli if hit following permission error

    Connection error while attempting to download client ([Errno 13] Permission denied: ‘/usr/local/bin/kubectl‘
    

    4. Install helm

    Follow detailed installation steps here.

    • Example:
    # Install wordpress
    helm repo add bitnami https://charts.bitnami.com/bitnami
    helm install bitnami/wordpress --set global.imageRegistry=dockerhub.azk8s.cn
    
    # Install nginx-ingress
    helm repo add stable https://mirror.azure.cn/kubernetes/charts/
    helm install stable/nginx-ingress  --set defaultBackend.image.repository=gcr.azk8s.cn/google_containers/defaultbackend
    

    Note: All kubernetes related binaries on github could be found under https://mirror.azk8s.cn/kubernetes, e.g. helm, charts, etc.

    5. Cluster autoscaler

    Note: AKS integrated Cluster-autoscaler is not availalbe on Azure China now since it‘s still in Preview on Global Azure, instead following autoscaler is supported on Azure China now, it supports both VMAS and VMSS: Follow detailed steps in Cluster Autoscaler on Azure and in Deployment config of aks-cluster-autoscaler.yaml:

    • use gcr.azk8s.cn/google-containers/cluster-autoscaler:version instead of gcr.io/google-containers/cluster-autoscaler:version
    • add following environment variable:
      - name: ARM_CLOUD
        value: AzureChinaCloud
      

      Here is the complete Deployment config example.

    Hands on

    Known issues

    Tips

    • For production usage:

      • agent VM size should have at least 8 CPU cores(e.g. D4_v2) since k8s components would also occupy CPU, memory resources on the node, details about AKS resource reservation.
      • it‘s better set a bigger os disk size on agent VM in AKS cluster creation, e.g. set --node-osdisk-size 128, original 30GB os disk size is not enough since all images are stored on os disk.
    • GPU workload support best practices on Azure China

    Links

原文地址:https://www.cnblogs.com/jinanxiaolaohu/p/11353408.html

时间: 2024-08-30 09:36:39

[转帖]k8s国内镜像的相关文章

Maven的国内镜像(解决jar下载过慢)

Maven简介 maven作为一个项目管理工具确实非常好用,结果在使用时候,你会发现下载jar速度不如自己在网上下载.之前oschina的中央仓库可用,现在oschina的maven服务器关了,只能拿国内镜像来替代.在网上发现阿里云公开了一个中央仓库,就顺手写下来了,方便以后使用. 修改Maven目录中的conf/settings.xml 找到mirrors节点,添加到节点下 1.这是阿里云仓库 <mirror> <id>alimaven</id> <name&g

同步、更新、下载Android Source & SDK from 国内镜像站

转自: 同步.更新.下载Android Source & SDK from 国内镜像站 Download the android source from china mirrors???? 以前都是从Google的站点下载同步更新的,但是现在有了国内的镜像站点就好多了 帮助 ?https://wiki.tuna.tsinghua.edu.cn/MirrorUsage/android ? 仓库地址: git://aosp.tuna.tsinghua.edu.cn/android/ ? 使用浏览器访

npm 国内镜像资源 --转载

npm 是node.js 环境下的包管理器,非常强大智能. 生活这这片神奇的土地上,各种奇葩手段屡见不鲜啊. 为什么要换源? npm 官方站点 http://www.npmjs.org/ 并没有被墙,但是下载第三方依赖包的速度让人着急啊! 就拿阿里云环境来说,有时npm 一个包也需要耐心等待......等待过去也许是原地踏步,也许就是安装失败. 幸运的是,国内有几个镜像站点可以供我们使用,本人在使用 http://www.cnpmjs.org/ 速度非常快,镜像站会实时更新,为我们节省了好多时间

maven,阿里云国内镜像,提高jar包下载速度

镜像 maven默认会从中央仓库下载jar包,这个仓库在国外,而且全世界的人都会从这里下载,所以下载速度肯定是非常慢的.镜像就相当于是中央仓库的一个副本,内容和中央仓库完全一样,目前有不少国内镜像,其中阿里云算是比较稳定的,同时也能保证下载速度 配置方法 在settings.xml 中配置,所有项目都会生效 [html] view plain copy <mirrors> <mirror> <id>alimaven</id> <name>aliy

170220、maven国内镜像 阿里云

maven确实是一个好东西,但是在国内下载官方仓库的jar却是个大问题,速度不敢恭维,现在oschina的国内maven镜像服务已关闭,无奈之下只能另寻门路. 今天突然发现了阿里云maven国内镜像,修改完以后速度飞一般的感觉,超赞,这个激动啊... 修改方法:在~/.m2目录下的settings.xml文件中,(如果该文件不存在,则需要从maven/conf目录下拷贝一份),找到<mirrors>标签,添加如下子标签: <!--阿里云maven国内镜像--> <mirror

Node.js NPM国内镜像

NPM国内镜像 http://npm.hacknodejs.com/ http://registry.npmjs.vitecho.com/ https://registry.npm.taobao.org 永久使用镜像命令: npm config set registry https://registry.npm.taobao.org 临时使用镜像命令: npm --registry "http://npm.hacknodejs.com/" install underscore

pip使用国内镜像

使用国内镜像通过pip安装python 包 pip安装python包时超时或是报错"Cannot fetch index base URL http://e.pypi.python.org/simple/" 解决方法:加上参数"-i http://pypi.v2ex.com/simple",即换成国内镜像. 一劳永逸的办法:~/.pip/ 下创建文件 pip.conf(如果还没有的话),并填入以下内容: [global] timeout = 6000 index-u

npm国内镜像

这个也是网上搜的,亲自试过,非常好用! 镜像使用方法(三种办法任意一种都能解决问题,建议使用第三种,将配置写死,下次用的时候配置还在): 通过config命令 npm config set registry http://registry.npm.taobao.org npm info underscore (如果上面配置正确这个命令会有字符串response) 命令行指定 npm –registry http://registry.npm.taobao.org info underscore

同步、更新、下载Android Source &amp; SDK from 国内镜像站(转载)

同步.更新.下载Android Source & SDK from 国内镜像站 转自: Download the android source from china mirrors 以前都是从Google的站点下载同步更新的,但是现在有了国内的镜像站点就好多了 帮助  https://wiki.tuna.tsinghua.edu.cn/MirrorUsage/android 仓库地址: git://aosp.tuna.tsinghua.edu.cn/android/ 使用浏览器访问: http: