ubuntu搭建k8s1.13.2

项目需要,没得办法,就利用ubuntu16.04重新搭建了k8s 1.13.2的版本

步骤不相同的地方:

1、修改主机名

vim /etc/hostname

2、把主机名与ip做映射

vim /etc/hosts

3、修改IP地址

先有ifconfig命令查看网卡名字
在这里插入图片描述
知道网卡是ens33后,修改配置文件

vim /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#auto ens33
#iface ens33 inet dhcp
auto ens33
iface ens33 inet static
#设置这里的静态ip
address 192.168.37.103
#子网掩码
netmask 255.255.255.0
#网关
gateway 192.168.37.2
#DNS
dns-nameservers 8.8.8.8

特别注意,如果你用的是虚拟机,gateway需要看你虚拟机虚拟网络的设置
在这里插入图片描述
我这里用的是NAT模式,点击NAT设置
在这里插入图片描述
gateway的网关IP和子网掩码就在上面
在这里插入图片描述
修改完端口文件后还要修改DNS(可选,因为我改了后一重启文件又恢复原样)

vim /etc/resolv.conf

添加或修改如下内容

#Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#DO NOT EDIT THIS FILE BY HAND – YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
#上面的内容是原来就有的,下面是新加的内容。
nameserver 114.114.114.114
nameserver 8.8.8.8

然后记得要重启ssh服务

重启网络服务

sudo service networking restart

重启DNS服务

sudo service resolvconf restart

最后要记得reboot重启。

参考链接:https://blog.csdn.net/ZPeng_CSDN/article/details/103319559

特别注意  把ubuntu的IP改成静态的IP否则会出现问题

方法:

1  关闭swap分区

2   安装指定版本

apt-get install -y kubernetes-cni=0.6.0-00 kubelet=1.13.2-00 kubeadm=1.13.2-00 kubectl=1.13.2-00 --allow-unauthenticated 

3  docker安装指定的版本

https://blog.csdn.net/waitstory12/article/details/103237776

4 设置kubectl的密钥

curl -s https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg| sudo apt-key add -

5 设置流量桥接均为1

sysctl net.bridge.bridge-nf-call-iptables=1

6 安装init

kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=192.168.26.128 --kubernetes-version=v1.13.2 --ignore-preflight-errors=Swap 


7 helm安装

helm安装和使用  http://www.mamicode.com/info-detail-2990205.html

8 flannel网络

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/a70459be0084506e4ec919aa1c114638878db11b/Documentation/kube-flannel.yml

 

 

参考连接

https://blog.csdn.net/wangchunfa122/article/details/86529406

https://blog.csdn.net/bugnuke123/article/details/97176601?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.channel_param

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值