K8S配置安装全过程
V1.11.1
https://github.com/kubernetes/kubernetes/releases/tag/v1.11.1
环境准备:
系统:centos7.2.1511
[root@master ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
关闭防火墙,iptalbes,firewalld设置时间同步
systemctl stop iptalbes
systemctl disable iptalbes
systemctl stop firewalld
systemctl disable firewalld
禁用SELINUX:
setenforce 0
修改selinux
vim /etc/selinux/config文件
SELINUX=disabled
改主机名:
~]# hostnamectl set-hostname master
修改hosts
[root@master ~]# vim /etc/hosts
172.20.0.70 master
172.20.0.66 node1
172.20.0.67 node2
---------------------------------------------------------------------------------------
master:
[root@master~]# cd /etc/yum.repos.d/
下载阿里云docker-ce.repo
[root@server yum.repos.d]# wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
配置k8s repo
[root@master yum.repos.d]# vim kubernetes.repo
[kubernetes]
name=kubernetes repo
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kuberne
tes-el7-x86_64/
gpgcheck=0
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
enabled=1
[root@master yum.repos.d]#yum repolist
[root@master ~]# wget https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
[root@master ~]# rpm --import rpm-package-key.gpg
[root@master ~]# wget https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
[root@master ~]# rpm --import yum-key.gpg
===============================
安装docker-ce kubelet kubeadm kubectl
[root@master yum.repos.d]# yum install docker-ce kubelet kubeadm kubectl
配置docker服务
[root@master yum.repos.d]# vim /usr/lib/systemd/system/docker.service
[Service]
Environment="HTTPS_PROXY=http://www.ik8s.io:10080"
Environment="NO_PROXY=127.0.0.0/8,172.20.0.0/16"
[root@server yum.repos.d]# systemctl daemon-reload
[root@master yum.repos.d]# systemctl start docker.service
[root@master yum.repos.d]# docker info
验证itables桥是否为1
[root@master ~]# cat /proc/sys/net/bridge/bridge-nf-call-ip6tables
[root@master ~]# cat /proc/sys/net/bridge/bridge-nf-call-iptables
如不为1,则在/etc/sysctl.conf中添加:
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
执行sysctl -p 时出现:
[root@localhost ~]# sysctl -p
sysctl: cannot stat /proc/sys/net/bridge/bridge-nf-call-ip6tables: No such file or directory
sysctl: cannot stat /proc/sys/net/bridge/bridge-nf-call-iptables: No such file or directory
解决方法:
[root@localhost ~]# modprobe br_netfilter
[root@localhost ~]# sysctl -p
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
自启动kubelet,docker
[root@master ~]# systemctl enable kubelet.service
root@master ~]# systemctl enable docker.service
启动kubelet,docker
[root@master ~]# systemctl start kubelet.service
root@master ~]# systemctl start docker.service
忽略swap报错
[root@master ~]# vim /etc/sysconfig/kubelet
KUBELET_EXTRA_ARGS="--fail-swap-on=false"
初始化kubeadm
[root@master ~]# kubeadm init --kubernetes-version=v1.11.1 --pod-network-cidr=10.244.0.0/16 --service-cidr=10.96.0.0/12 --ignore-preflight-errors=Swap
kubeadm join 172.20.0.70:6443 --token dis2yz.m446ryn2lr298ica --discovery-token-ca-cert-hash sha256:c59f3633ecb92a31d86f64dc304abea55176555afbb3f2af9f40e5d4e013f86b
[root@master ~]# docker image ls
检测端口是否启动
[root@master ~]# ss -tnl | grep 6443
[root@master ~]# mkdir -p $HOME/.kube
[root@master ~]# cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
[root@master ~]# kubectl get cs
NAME STATUS MESSAGE ERROR
scheduler Healthy ok
etcd-0 Healthy {"health": "true"}
controller-manager Healthy ok
[root@master ~]# kubectl get componentstatus
NAME STATUS MESSAGE ERROR
scheduler Healthy ok
controller-manager Healthy ok
etcd-0 Healthy {"health": "true"}
[root@master ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
master NotReady master 32m v1.11.2
部署flannel网络插件
[root@master ~]# kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
检测flannel
[root@master ~]# kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
coredns-78fcdf6894-4smdl 1/1 Running 58 20h
coredns-78fcdf6894-tlklk 1/1 Running 55 20h
etcd-master 1/1 Running 4 19h
kube-apiserver-master 1/1 Running 54 19h
kube-controller-manager-master 1/1 Running 9 19h
kube-flannel-ds-amd64-ds7x5 1/1 Running 2 19h
kube-proxy-tsxvp 1/1 Running 2 20h
kube-scheduler-master 1/1 Running 7 19h
[root@master ~]# kubectl get ns
NAME STATUS AGE
default Active 20h
kube-public Active 20h
kube-system Active 20h
master部署完毕
=============================================================
nodes节点
复制repo至node1,node2
[root@master ~]# scp /etc/hosts node1:/etc/hosts
[root@master ~]# scp /etc/hosts node2:/etc/hosts
[root@master yum.repos.d]# scp docker-ce.repo kubernetes.repo node1:/etc/yum.repos.d/
[root@master yum.repos.d]# scp docker-ce.repo kubernetes.repo node2:/etc/yum.repos.d/
[root@master ~]# scp rpm-package-key.gpg node1:/root
[root@master ~]# scp rpm-package-key.gpg node2:/root
------------------------------------------------------------------------------------------------------------------------------------------
node1:
[root@node1 # rpm --import rpm-package-key.gpg
[root@node1 #yum repolist
[root@node1# yum install docker-ce kubelet kubeadm -y
复制master配置至node1
[root@master ~]# scp /usr/lib/systemd/system/docker.service node1:/usr/lib/systemd/system/docker.service
[root@master ~]# scp /etc/sysconfig/kubelet node1:/etc/sysconfig/kubelet
[root@master ~]# scp /etc/sysctl.conf node1:/etc/sysctl.conf
验证itables桥是否为1
[root@master ~]# cat /proc/sys/net/bridge/bridge-nf-call-ip6tables
[root@master ~]# cat /proc/sys/net/bridge/bridge-nf-call-iptables
如不为1,则在/etc/sysctl.conf中添加:
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
执行sysctl -p 时出现:
[root@localhost ~]# sysctl -p
sysctl: cannot stat /proc/sys/net/bridge/bridge-nf-call-ip6tables: No such file or directory
sysctl: cannot stat /proc/sys/net/bridge/bridge-nf-call-iptables: No such file or directory
解决方法:
[root@localhost ~]# modprobe br_netfilter
[root@localhost ~]# sysctl -p
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
[root@node1 ~]# systemctl start docker kubelet
[root@node1 ~]# systemctl enable docker kubelet
[root@master ~]# scp /etc/sysctl.conf node2:/etc/sysctl.conf
[root@node1 ~]# kubeadm join 172.20.0.70:6443 --token dis2yz.m446ryn2lr298ica --discovery-token-ca-cert-hash sha256:c59f3633ecb92a31d86f64dc304abea55176555afbb3f2af9f40e5d4e013f86b --ignore-preflight-errors=All
[root@master ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
master Ready master 20h v1.11.2
node1 NotReady <none> 49s v1.11.2
[root@node1 ~]# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
k8s.gcr.io/kube-proxy-amd64 v1.11.1 d5c25579d0ff 6 weeks ago 97.8MB
quay.io/coreos/flannel v0.10.0-amd64 f0fad859c909 7 months ago 44.6MB
k8s.gcr.io/pause 3.1 da86e6ba6ca1 8 months ago 742kB
[root@master ~]# kubectl get pods -n kube-system -o wide
NAME READY STATUS RESTARTS AGE IP NODE
coredns-78fcdf6894-4smdl 1/1 Running 58 20h 10.244.0.7 master
coredns-78fcdf6894-tlklk 1/1 Running 55 20h 10.244.0.6 master
etcd-master 1/1 Running 4 20h 172.18.0.67 master
kube-apiserver-master 1/1 Running 54 20h 172.18.0.67 master
kube-controller-manager-master 1/1 Running 9 20h 172.18.0.67 master
kube-flannel-ds-amd64-ds7x5 1/1 Running 2 20h 172.18.0.67 master
kube-flannel-ds-amd64-ktw9f 1/1 Running 0 4m 172.18.0.68 node1
kube-proxy-lqpms 1/1 Running 0 4m 172.18.0.68 node1
kube-proxy-tsxvp 1/1 Running 2 20h 172.18.0.67 master
kube-scheduler-master 1/1 Running 7 20h 172.18.0.67 master
------------------------------------------------------------------------------------------------------------------------------------------
node2
[root@node1 # rpm --import rpm-package-key.gpg
[root@node2] #yum repolist
[root@node2]# yum install docker-ce kubelet kubeadm -y
复制master配置至node2
[root@master ~]# scp /usr/lib/systemd/system/docker.service node1:/usr/lib/systemd/system/docker.service
[root@master ~]# scp /etc/sysconfig/kubelet node1:/etc/sysconfig/kubelet
验证itables桥是否为1
[root@master ~]# cat /proc/sys/net/bridge/bridge-nf-call-ip6tables
[root@master ~]# cat /proc/sys/net/bridge/bridge-nf-call-iptables
如不为1,则在/etc/sysctl.conf中添加:
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
执行sysctl -p 时出现:
[root@localhost ~]# sysctl -p
sysctl: cannot stat /proc/sys/net/bridge/bridge-nf-call-ip6tables: No such file or directory
sysctl: cannot stat /proc/sys/net/bridge/bridge-nf-call-iptables: No such file or directory
解决方法:
[root@localhost ~]# modprobe br_netfilter
[root@localhost ~]# sysctl -p
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
[root@node2 ~]# systemctl start kubelet docker
[root@node2 ~]# systemctl enable kubelet docker
[root@node1 ~]# kubeadm join 172.20.0.70:6443 --token dis2yz.m446ryn2lr298ica --discovery-token-ca-cert-hash sha256:c59f3633ecb92a31d86f64dc304abea55176555afbb3f2af9f40e5d4e013f86b --ignore-preflight-errors=All
自此部署完毕master及note节点
-----------------------------------
检查master
[root@master ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
master Ready master 21h v1.11.2
node1 Ready <none> 46m v1.11.2
node2 NotReady <none> 28m v1.11.2
K8S配置安装全过程的更多相关文章
- 安装配置FreeBSD9全过程体验
安装配置FreeBSD9全过程体验(时长11分钟) 总所周知,FreeBSD是一个高效.稳定的UNIX操作系统.在今年年初,FreeBSD 又发布了9.0版本,它将采用全新的文本安装器,升级ZFS文件 ...
- CentOS 6.0图解网络安装全过程
转自CentOS 6.0图解网络安装全过程 国内镜像站点(东北大学.网易) 网易镜像站点:http://mirrors.163.com/centos/6.0/isos/ 中科大镜像站点:http:// ...
- PYQT4 + Python2.6 + eric4-4.2.2a的安装全过程
PYQT4 + Python2.6 + eric4-4.2.2a的安装全过程 - beike - ITeye技术网站 PYQT4 + Python2.6 + eric4-4.2.2a的安装全过程 博客 ...
- FastDFS安装全过程记录(V5.05)
FastDFS安装全过程记录 1.安装准备 HA虚拟IP:192.168.1.208 HA软件:Keepalived 操作系统:CentOS 7 用户:root 数据目录:/data/fastdfs ...
- Redis介绍——Linux环境Redis安装全过程和遇到的问题及解决方案
一:redis的入门介绍: 首先贴出官网; 英文:https://redis.io/ 中文:http://www.redis.cn/ 1.是什么 --REmote DIctionary Server( ...
- FastDFS部署安装全过程
你好!欢迎阅读我的博文,你可以跳转到我的个人博客网站,会有更好的排版效果和功能. 此外,本篇博文为本人Pushy原创,如需转载请注明出处:https://pushy.site/posts/153205 ...
- 在k8s上安装Jenkins及常见问题
持续集成和部署是DevOps的重要组成部分,Jenkins是一款非常流行的持续集成和部署工具,最近试验了一下Jenkins,发现它是我一段时间以来用过的工具中最复杂的.一个可能的原因是它需要与各种其它 ...
- 国内不fq安装K8S四: 安装过程中遇到的问题和解决方法
目录 4 安装过程中遇到的问题和解决方法 4.1 常见问题 4.2 常用的操作命令 4.3 比较好的博客 国内不fq安装K8S一: 安装docker 国内不fq安装K8S二: 安装kubernet 国 ...
- 国内不fq安装K8S二: 安装kubernet
目录 2 安装kubelet 2.1 环境准备 2.2 设置国内的源 2.3 重要的设置 2.4 获取镜像 2.5 使用kubeadm init初始化集群 2.6 安装Pod Network 2.7 ...
随机推荐
- 利用mybatis-generator自动生成代码,发生:Plugin execution not covered by lifecycle configuration后解决方案
1,报错信息 Plugin execution not covered by lifecycle configuration: org.mybatis.generator:mybatis-genera ...
- pkuwc2019游记
填坑 为了打击胡吹瞎吹恶势力 具体考试情况略了 题解 Day1 D1T1 100分 状压dp 考虑用点的存在状态转移边的情况的思想 D1T2 100分 虚树+ntt 假设在最下方的斯坦纳树上统计答案, ...
- linux文件查找-find和locate
一.find 使用语法:find [查找目录] [查找规则] [查找完后执行的action] find是根据具体目录进行搜索 1.查找目录 如果不指定查找目录,默认在当前目录下进行查找 如果需要 ...
- 详解docker中容器devicemapper设备的挂载流程
事故起因 版本说明:本文中docker版本主要基于1.10版本,操作系统为centos7.devicemapper在文中缩写为dm. 某个用户的容器启动不起来,启动时候一直报错.通过docker lo ...
- 一个基于nuxt的基础架子,支持aixos,sass,es6,elementUI
nuxt官网:Nuxt.js docs github: 项目地址 项目版本说明 package 版本号 "babel-cli" "^6.26.0" " ...
- 类的综合运用-complex的实现
实验要求: 定义一个复数类Complex,使得下面的代码能够工作: Complex c1(3,5); //用复数3+5i初始化c1: Compex c2=4.5; //用实数4.5初 ...
- MyBatis-plus使用
https://blog.csdn.net/qq_32867467/article/details/82944674 官网: https://mp.baomidou.com/guide/optimis ...
- stm32库函数建工程和使用Keil自带库建工程有没有区别?发现了同样的程序在两种情况下keil自带库可以运行的情况,不知是什么原因
我使用库函数建的工程(非Keil自带库),为了实现SPI对Si24r1芯片数据的读写,以验证stm32是否可以和si24r1能够正常通信,发现使用库函数建的工程程序不能通过,读出来的数据和写的数据不一 ...
- unittest同时支持参数化和生成html报告
最近在用python3.6+unittest+requests做自动化接口测试.发现一个问题,unittest中使用第3方插件parameterized进行参数化,再生成html报告时,运行就会失败. ...
- C++ 获取Unix时间戳
什么是Unix时间戳? Unix时间戳(Unix timestamp),或称Unix时间(Unix time).POSIX时间(POSIX time),是一种时间表示方式,定义为从格林威治时间1970 ...