欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

使用阿里巴巴开源镜像站镜像——Kubernetes 镜像

程序员文章站 2022-05-16 21:21:28
...

镜像下载、域名解析、时间同步请点击 阿里云开源镜像站

Kubernetes 镜像简介

Kubernetes 是一个开源系统,用于容器化应用的自动部署、扩缩和管理。它将构成应用的容器按逻辑单位进行分组以便于管理和发现。

下载地址:https://mirrors.aliyun.com/kubernetes/

Kubernetes 镜像配置方法

基于CentOS / RHEL / Fedora系统配置方法

(1)查看系统版本信息

  1. [root@centos ~]# hostnamectl
  2. Static hostname: centos
  3. Icon name: computer-vm
  4. Chassis: vm
  5. Machine ID: f6fc8fb7991c4c518238af7c75f16046
  6. Boot ID: baa5dae1c7614a0790ac9c3b5c0a9b7b
  7. Virtualization: vmware
  8. Operating System: CentOS Linux 7 (Core)
  9. CPE OS Name: cpe:/o:centos:centos:7
  10. Kernel: Linux 3.10.0-1160.el7.x86_64
  11. Architecture: x86-64

(2)添加并查看 Kubernetes.repo YUM源

  1. [root@centos ~]# 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. [root@centos ~]# cat /etc/yum.repos.d/kubernetes.repo
  11. [kubernetes]
  12. name=Kubernetes
  13. baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
  14. enabled=1
  15. gpgcheck=1
  16. repo_gpgcheck=1
  17. gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
  18. [root@centos ~]#

PS:由于官网未开放同步方式, 可能会有索引gpg检查失败的情况, 这时请用 yum install -y --nogpgcheck kubelet kubeadm kubectl 安装

(3)关闭或允许SELINUX安全模式

执行setenforce 0命令,暂时允许SELINUX安全模式放行通过。重启失效。

  1. [root@centos ~]# setenforce 0
  2. [root@centos ~]# getenforce
  3. permissive

编辑/etc/selinux/config配置文件,保存退出,重启生效。

  1. [root@centos ~]# vim /etc/selinux/config
  2. [root@centos ~]# cat /etc/selinux/config
  3. # This file controls the state of SELinux on the system.
  4. # SELINUX= can take one of these three values:
  5. # enforcing - SELinux security policy is enforced.
  6. # permissive - SELinux prints warnings instead of enforcing.
  7. # disabled - No SELinux policy is loaded.
  8. SELINUX=disabled
  9. # SELINUXTYPE= can take one of three values:
  10. # targeted - Targeted processes are protected,
  11. # minimum - Modification of targeted policy. Only selected processes are protected.
  12. # mls - Multi Level Security protection.
  13. SELINUXTYPE=targeted
  14. [root@centos ~]# getenforce
  15. Disabled

(4)安装kubernetes

  1. [root@centos ~]# yum install -y kubelet kubeadm kubectl
  2. Loaded plugins: fastestmirror
  3. Loading mirror speeds from cached hostfile
  4. * base: mirrors.aliyun.com
  5. * extras: mirrors.aliyun.com
  6. * updates: mirrors.aliyun.com
  7. Package kubelet-1.22.4-0.x86_64 already installed and latest version
  8. Package kubeadm-1.22.4-0.x86_64 already installed and latest version
  9. Package kubectl-1.22.4-0.x86_64 already installed and latest version
  10. Nothing to do
  11. [root@centos ~]#

使用阿里巴巴开源镜像站镜像——Kubernetes 镜像

(5)启动kubernetes

  1. [root@centos ~]# systemctl start kubelet
  2. [root@centos ~]# systemctl enable kubelet
  3. Created symlink from /etc/systemd/system/multi-user.target.wants/kubelet.service to /usr/lib/systemd/system/kubelet.service.

本文转自:xuyebao