kubernets单机版安装部署
- 检查linux内核版本:
Docker 要求 CentOS 系统的内核版本高于 3.10
uname -r
最好是更新到最新
sudo yum update
重启虚拟机
2.安装
切换成root
1.关闭centos自带的防火墙
systemctl disable firewalld
systemctl stop firewalld
2.安装etcd和kubernetes软件(会自动安装docker)
yum install -y etcd kubernetes
3.修改配置文件
vim /etc/sysconfig/docker
vim /etc/kubernetes/apiserver
把–admission_control参数中的ServiceAccount删除
3.启动所有服务
# systemctl start etcd
# systemctl start docker
# systemctl start kube-apiserver
# systemctl start kube-controller-manager
# systemctl start kube-scheduler
# systemctl start kubelet
# systemctl start kube-proxy
这里如果出现docker启动不了,就是因为第一步的原因导致,升级内核就可以了。
4.部署服务
$ kubectl run 名称 --image=镜像地址 --port=8010
$ kubectl get pod # 查看pod
这里查看pod如果一直处于 ContainerCreating 状态
kubectl describe pod 名称 #查看日志
出现的错误如下,我们去这个目录下查看,没有这个文件。
open /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt: no such file or directory
解决方案:
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/python-rhsm-certificates-1.19.10-1.el7_4.x86_64.rpm
rpm2cpio python-rhsm-certificates-1.19.10-1.el7_4.x86_64.rpm | cpio -iv --to-stdout ./etc/rhsm/ca/redhat-uep.pem | tee /etc/rhsm/ca/redhat-uep.pem
前两个命令会生成/etc/rhsm/ca/redhat-uep.pem文件
docker pull registry.access.redhat.com/rhel7/pod-infrastructure:latest
再查看已经处于运行状态了
kubectl get pod