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
    root@09feb993f352:/# az cloud set --name AzureChinaCloud
    root@09feb993f352:/# 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

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

  1. google gcr.io、k8s.gcr.io 国内镜像

    1.首先添加docker官方的国内镜像 sudo tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ...

  2. K8S学习笔记之将Google的gcr.io、k8s.gcr.io 换为国内镜像

    0x00 添加docker官方的国内镜像 sudo tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ...

  3. [K8S]kubeadm国内镜像安装方式

    使用国内镜像站 sudo apt-get update && sudo apt-get install -y apt-transport-https curl sudo curl -s ...

  4. docker学习(2) mac中docker-machine使用vmware fusion以及配置国内镜像加速

    一.前言 先回顾下上一节创建docker-machine的过程,默认情况下docker toolbox中的docker-machine使用virtual box创建虚拟机,KI首次启动时创建虚拟机的过 ...

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

    同步.更新.下载Android Source & SDK from 国内镜像站 转自: 同步.更新.下载Android Source & SDK from 国内镜像站 Download ...

  6. Docker - Docker国内镜像的配置及使用

    Docker国内镜像 DaoCloud - Docker加速器 阿里云 - 开发者平台 微镜像 - 希云cSphere 镜像广场 - 时速云 灵雀云 网易蜂巢 阿里云的Docker加速器 阿里云 - ...

  7. 使用国内镜像加速下载Android SDK

    本文转自:http://blog.kuoruan.com/24.html.感谢原作者. 什么是Android SDK SDK:(software development kit)软件开发工具包.被软件 ...

  8. 腾讯bugly团队提供的android国内镜像

    腾讯bugly团队提供的国内镜像   如果使用Android SDK Manager下载比较慢或者打不开,可以使用国内镜像 使用说明 http://android-mirror.bugly.qq.co ...

  9. eclipse使用国内镜像站点安装插件

    把eclipse 4.x的界面改为经典样式 打开eclipse,菜单栏>windows>preference>general>appearance>theme>cl ...

随机推荐

  1. 一个参数既可以是const还可以是volatile

    可以的,例如只读的状态寄存器.它是volatile因为它可能被意想不到地改变.它是const因为程序不应该试图去修改它. 一个定义为volatile的变量是说这变量可能会被意想不到地改变,这样,编译器 ...

  2. UVAlive 7414 Squeeze the Cylinders a,b,c三种步数 搜索+最短路

    题意:给你n个点(n<=50),然后有些点之间会有一条路,路是单向的,每个回合让你走a,b,c三种步数中的任意一种(a,b,c<=100),问你最少需要多少个回合才能保证一定能从1点到达n ...

  3. python 编写排列组合

    python在编写排列组合是会用到  itertools 模块 排列 import itertools mylist = list(itertools.permutations([)) # 全排列 p ...

  4. java虚拟机JVM

    Java Virtual Machine ,简称JVM; 它是运行所有Java程序的抽象计算机,是Java语言的运行环境,它是Java 最具吸引力的特性之一,JVM读取并处理编译过的与平台无关的字节码 ...

  5. 【零基础】搞懂GPU为什么比CPU“快”

    一.前言 近几年深度学习在各领域大显神威,而”GPU加速"也得到了越来越多的篇幅,似乎任何程序只要放到GPU上运行那速度就是杠杠的.GPU代替CPU计算已成了大势所趋?我先告诉你结论”那是不 ...

  6. linux向文件中添加数据,数据被追加到了上一行的行尾

    当我们在windows上新建了文件,并且要上传到linux上时,一定要在文件后加上空格,否则就会出现标题上讲的,数据被追加到了上一行的行尾,而不是新起一行,但是如果是在linux上新建的文件,则没有这 ...

  7. 性能测试 | Linux线程数、进程查询

    I. 最大值查询 1. 最大进程数查询 1 cat /proc/sys/kernel/pid_max 个人阿里云机器(单核2g)上输出如下 1 32768 2. 最大线程数查询 1 cat /proc ...

  8. 发布机制-灰度发布-例子:Gmail Labs

    ylbtech-发布机制-灰度发布-例子:Gmail Labs Gmail Labs是一个新特性橱窗,用户可以自己选择一些未正式发布的新特性进行体验,不喜欢可以关闭,在这个过程中,吃了螃蟹,也当了Go ...

  9. Android 电量优化

    Android系统上App的电量消耗主要由cpu.wakelock.数据传输(流量和wifi).wifi运行.gps.other senior组成,而耗电异常也是由于这几个模块的使用不当. Broad ...

  10. Kettle源码学习(一)——把Kettle项目跑起来

    kettle(pentaho data integration),是一款开源的C/S版的ETL工具,最近打算学习一下kettle源码,并自己写一个mini kettle,并改造成基于事件触发的流处理模 ...