Kubernetes

1、安装Kubernetes基础组件

配置镜像仓库

官方镜像源国内不可用

  1. $ cat <<EOF > /etc/yum.repos.d/kubernetes.repo
  2. [kubernetes]
  3. name=Kubernetes
  4. baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
  5. enabled=1
  6. gpgcheck=1
  7. repo_gpgcheck=1
  8. gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
  9. EOF
  10. $ yum install -y kubectl

配置使用阿里云镜像仓库并下载安装推荐

阿里云Kubernetes镜像地址:https://developer.aliyun.com/mirror/kubernetes?spm=a2c6h.13651102.0.0.5b791b11ILfyDS

  1. cat <<EOF > /etc/yum.repos.d/kubernetes.repo
  2. [kubernetes]
  3. name=Kubernetes
  4. baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
  5. enabled=1
  6. gpgcheck=1
  7. repo_gpgcheck=1
  8. gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
  9. EOF
  10. setenforce 0
  11. yum install -y kubelet kubeadm kubectl
  12. systemctl enable kubelet && systemctl start kubelet

image.png