k8s客户端 aliyun 代理

国内网络安装 k8s 命令行工具特别不方便, 我找到了阿里云的 yum 源来加速安装.

  1. 添加 yum 源代
    1
    vi /etc/yum.repos.d/kubernetes.repo

加入如下内容:

1
2
3
4
5
6
7
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg

  1. 安装 k8s 命令行工具

    1
    yum install -y kubelet kubeadm kubectl
  2. 检查安装结果

    1
    2
    3
    4
    [vagrant@localhost ~]$ kubectl version
    Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.1", GitCommit:"b7394102d6ef778017f2ca4046abbaa23b88c290", GitTreeState:"clean", BuildDate:"2019-04-08T17:11:31Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
    The connection to the server localhost:8080 was refused - did you specify the right host or port?
    [vagrant@localhost ~]$

Ok , 安装成功了.