kubernetes集群搭建与管理

写在前面

基础知识

安装

1、更换阿里云的系统和kubernetes的源

在所有节点上安装kubeadm,这里使用阿里云的系统和kubernetes的源, 修改/etc/apt/sources.list的内容, 将下面的内容添加进去. 并且使用apt-get update -y 更新源

# 系统安装源
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
# kubeadm及kubernetes组件安装源
deb https://mirrors.aliyun.com/kubernetes/apt kubernetes-xenial main

2、安装kubeadm, kubectl, kubelet软件包

apt-get install -y kubelet kubeadm kubectl --allow-unauthenticated

安装过程中可能会出现下面的问题:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  conntrack cri-tools ebtables kubernetes-cni socat
The following NEW packages will be installed:
  conntrack cri-tools ebtables kubeadm kubectl kubelet kubernetes-cni socat
0 upgraded, 8 newly installed, 0 to remove and 289 not upgraded.
Need to get 52.9 MB of archives.
After this operation, 280 MB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
  cri-tools kubernetes-cni kubelet kubectl kubeadm
E: There were unauthenticated packages and -y was used without --allow-unauthenticated

需要在后面加上--allow-unauthenticated

3、

参考文献

Kubernetes(K8s)基础知识(docker容器技术)

Kubernetes(K8S)集群管理Docker容器(部署篇)

K8S与docker常见问题及解决办法

陌陌基于K8s和Docker容器管理平台的架构实践

Kubernetes系列之一:在Ubuntu上快速搭建一个集群Demo