[转帖]k8s国内镜像
k8s国内镜像
最近折腾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
|
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.io
,gcr.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.61
dockerhub.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 togcr.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
asgcr.azk8s.cn/google_containers/defaultbackend
in nginx-ingress chart since originalk8s.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 downloadkubectl
binary, it works on Azure China from version2.0.61
or later, another alternative is use following command to downloadkubectl
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 errorConnection 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 ofaks-cluster-autoscaler.yaml
:use
gcr.azk8s.cn/google-containers/cluster-autoscaler:version
instead ofgcr.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
- RBAC related issues(RABC is enabled on AKS cluster): https://github.com/andyzhangx/demo/blob/master/issues/rbac-issues.md
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.
Links
[转帖]k8s国内镜像的更多相关文章
- google gcr.io、k8s.gcr.io 国内镜像
1.首先添加docker官方的国内镜像 sudo tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ...
- K8S学习笔记之将Google的gcr.io、k8s.gcr.io 换为国内镜像
0x00 添加docker官方的国内镜像 sudo tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ...
- [K8S]kubeadm国内镜像安装方式
使用国内镜像站 sudo apt-get update && sudo apt-get install -y apt-transport-https curl sudo curl -s ...
- docker学习(2) mac中docker-machine使用vmware fusion以及配置国内镜像加速
一.前言 先回顾下上一节创建docker-machine的过程,默认情况下docker toolbox中的docker-machine使用virtual box创建虚拟机,KI首次启动时创建虚拟机的过 ...
- 同步、更新、下载Android Source & SDK from 国内镜像站(转载)
同步.更新.下载Android Source & SDK from 国内镜像站 转自: 同步.更新.下载Android Source & SDK from 国内镜像站 Download ...
- Docker - Docker国内镜像的配置及使用
Docker国内镜像 DaoCloud - Docker加速器 阿里云 - 开发者平台 微镜像 - 希云cSphere 镜像广场 - 时速云 灵雀云 网易蜂巢 阿里云的Docker加速器 阿里云 - ...
- 使用国内镜像加速下载Android SDK
本文转自:http://blog.kuoruan.com/24.html.感谢原作者. 什么是Android SDK SDK:(software development kit)软件开发工具包.被软件 ...
- 腾讯bugly团队提供的android国内镜像
腾讯bugly团队提供的国内镜像 如果使用Android SDK Manager下载比较慢或者打不开,可以使用国内镜像 使用说明 http://android-mirror.bugly.qq.co ...
- eclipse使用国内镜像站点安装插件
把eclipse 4.x的界面改为经典样式 打开eclipse,菜单栏>windows>preference>general>appearance>theme>cl ...
随机推荐
- CSS权重;慎用!important
初初接触样式的前端开发者在碰到样式覆盖时,最先选择的往往是!important. 但是这种做法不好,应该优先考虑从样式的级联属性或者位置来解决问题. 切记以下情况永远不要使用!important: 1 ...
- Call JMS Web Service
The content type application/json of the response message does not match the content type of the bin ...
- Java进阶知识11 Hibernate多对多单向关联(Annotation+XML实现)
1.Annotation 注解版 1.1.应用场景(Student-Teacher):当学生知道有哪些老师教,但是老师不知道自己教哪些学生时,可用单向关联 1.2.创建Teacher类和Student ...
- SpringMVC——拦截器,过滤器实现登录拦截
一.拦截器与过滤器的区别 1.过滤器 依赖于servlet容器.在实现上基于函数回调,可以对几乎所有请求进行过滤,但是缺点是一个过滤器实例只能在容器初始化时调用一次.使用过滤器的目的是用来做一些过滤操 ...
- codeforces gym #101161G - Binary Strings(矩阵快速幂,前缀斐波那契)
题目链接: http://codeforces.com/gym/101161/attachments 题意: $T$组数据 每组数据包含$L,R,K$ 计算$\sum_{k|n}^{}F(n)$ 定义 ...
- codeforces#1150D. Three Religions(dp+序列自动机)
题目链接: https://codeforces.com/contest/1150/problem/D 题意: 给出长度为$n$的字符串,和$q$次询问 每次询问是,给$x$宗教增加一个字符$key$ ...
- lyc——2019.10.31
10:判决素数个数 总时间限制: 1000ms 内存限制: 65536kB 描述 输入两个整数X和Y,输出两者之间的素数个数(包括X和Y). 输入 两个整数X和Y(1 <= X,Y <= ...
- JavaWeb_(Spring框架)Spring整合Hibernate
Dao层类要继承HibernateDaoSupport.java父类 原先使用Hibernate框架hibernate.cfg.xml配置数据库 <hibernate-configuration ...
- 【洛谷1361】 小M的作物(最小割)
传送门 洛谷 Solution 这是一个比较实用的套路,很多题目都有用,而且这个套路难以口胡出来. 考虑把每一个附加贡献重新建一个点,然后向必需的点连边,流量为val. 然后直接种植的从源点向这个点连 ...
- 1.4 JAVA日期处理
一.JAVA日期 参考链接:https://www.runoob.com/java/java-date-time.html 1.日期两个构造函数 1.第一个构造函数使用当前日期和时间来初始化对象.Da ...