Kubernetes Yum源搭建
2016-12-11 本文已影响504人
刘海伟
Yum服务端
有2种方法,下载或者构建
下载RPM包
yumdownloader --resolve kubeadm
createrepo .
结果:
.
|-- 3d1989047376dac20d2fb08f000b4ff97214772205146081cb7793dd0c53c457-kubelet-1.4.4-3.x86_64.rpm
|-- 783f520486f23c43a18b110e4c8585e62d5e534f8d3098644aaab50e9e4de23e-kubeadm-1.5.0-3.alpha.2.421.a6bea3d79b8bba.x86_64.rpm
|-- 91b2a81ddab9261fadc380e5af242817871ad051418b1434d1c4820d8380010d-kubernetes-cni-0.3.0.1-3.07a8a2.x86_64.rpm
|-- f72890805fbf40309e9e33be5375c71bcd09e7d390aed40e6d2a70267ce42450-kubectl-1.4.4-3.x86_64.rpm
`-- repodata
|-- 368ead4b92f75214e36a621bcf20f726c89ef27baa45e2aa59f3a8c6debce549-other.sqlite.bz2
|-- 6bfe808819765c611bc76e8398424afe529444486dc577498db55c658cbdcadc-primary.sqlite.bz2
|-- 83319a0322c9508479d08be2018bfe4f82ce47cdb5dc766dc1a64cf3029004c5-filelists.sqlite.bz2
|-- 83e8ed8a0094ab6b4ffe78f553851fb0f1521d4e19ce191df6b3274994927d47-primary.xml.gz
|-- a9ecad6a82b474ebdf149572e962aac68890823f0e01f32135082f0a42a1440e-other.xml.gz
|-- d27dc1cd8b8915d041b7f943d955262accbba0f2c515e81574269db1d7a9379c-filelists.xml.gz
`-- repomd.xml
构建RPM包
请在海外服务器执行命令,推荐digitalocean,附注推荐链接:https://m.do.co/c/a0a7ea977d47
如果需要构建指定版本的话,修改kubelet.spec里的字段:
- KUBE_VERSION
- KUBEADM_VERSION
git clone https://github.com/kubernetes/release.git
cd rpm
./docker-build.sh
构建结果
output/
└── x86_64
├── kubeadm-1.5.0-2.alpha.2.421.a6bea3d79b8bba.x86_64.rpm
├── kubectl-1.4.6-2.x86_64.rpm
├── kubelet-1.4.6-2.x86_64.rpm
├── kubernetes-cni-0.3.0.1-2.07a8a2.x86_64.rpm
└── repodata
├── 395db8ee7d145592d892f1d403fcead6a641626feb3d3e6e91823a207dfb2e1a-other.sqlite.bz2
├── 4870a55633bba841fd4940c3630a3d230238a770864bc928f3643a8cbb9b1e91-primary.sqlite.bz2
├── 75df13ffc7c7af0444a771bc3e1e683bc238437f1beb52e5c20971b2b57d17fc-other.xml.gz
├── 9876b004d32f9aad4774f473baa4c314e338291fdfd06bd9c82189ab31e42629-filelists.sqlite.bz2
├── b1b09a99e541133504598d2f1735d0a5dd1113debfd9ed3f231ce8df84dde441-primary.xml.gz
├── da109d1f015ea20d905d470324d4b598fed41a2ec054107fd5c8c64dc3b06389-filelists.xml.gz
└── repomd.xml
将构建的output/x86_64放到搭建好的文件服务器上即可,可以将x86_64重命名为kubernetes-el7-x86_64
客户端配置
sudo tee /etc/yum.repos.d/kubernetes.repo << EOF
[Kubernetes]
name = Kubernetes YUM repository
baseurl = 文件服务器上的kubernetes-el7-x86_64的URL
enabled = 1
gpgcheck = 0
EOF