使用|使用 kubeadmin 离线部署 kubernetes1.9
2019独角兽企业重金招聘Python工程师标准>>>
文章图片
一、环境介绍:
【使用|使用 kubeadmin 离线部署 kubernetes1.9】1、操作系统:
centos7.33.10.0-693.el7.x86_64
2、主机名
node1 192.168.5.251
node2 192.168.5.252
node3 192.168.5.253
二:配置基础环境
1、配置node3结点与其他结点互信
[root@node3 ~]# ssh-keyge
[root@node3 ~]# ssh-copy-id node1
[root@node3 ~]# ssh-copy-id node22、下载网盘的离线包,解压后复制到所有结点
链接: https://pan.baidu.com/s/1QzA7d86XgNamMR80aTrY9g 密码: ovar3、安装docker软件包(所有结点)
https://yq.aliyun.com/articles/1108064、系统路由参数,防止kubeadm报路由警告(所有结点)
echo "
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
" >> /etc/sysctl.conf
sysctl -p5、导入docker镜像(所有结点)
[root@node3 k8s]# cd /root/k8s/
[root@node3 k8s]# find . -name "*.tar" -exec docker image load -i {} \;
6、安装RPM包(所有结点)
rpm -ivh socat-1.7.3.2-2.el7.x86_64.rpm
rpm -ivh kubernetes-cni-0.6.0-0.x86_64.rpmkubelet-1.9.9-9.x86_64.rpmkubectl-1.9.0-0.x86_64.rpm
rpm -ivh kubectl-1.9.0-0.x86_64.rpm
rpm -ivh kubeadm-1.9.0-0.x86_64.rpm7、修改kubernetes使用docker默认driver(所有结点)
sed -i 's#systemd#cgroupfs#g' /etc/systemd/system/kubelet.service.d/10-kubeadm.conf8、配置node3结点,使用kubectl命令补全功能
[root@node3 k8s]# echo "source <(kubectl completion bash)" >> ~/.bashrc
三、使用kubeadm生成kubernetes集群
1、node3结点,启动kubelet服务
[root@node3 rpm]# systemctl enable kubelet && sudo systemctl start kubelet2、node3结点,初始化kubernetes集群
[root@node3 rpm]# kubeadm init --kubernetes-version=v1.9.0 --pod-network-cidr=10.244.0.0/16To start using your cluster, you need to run the following as a regular user:mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/configYou should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/You can now join any number of machines by running the following on each node
as root:kubeadm join --token e96cd7.9ffface2d57aa555 192.168.5.253:6443 --discovery-token-ca-cert-hash sha256:aa954aab7600e26dfc4c356a85c7a73a0e4dff264e26fe3a68f380c57f0d8bb63、按上述操作,验证加入集群
[root@node3 ~]# kubectl get node
NAMESTATUSROLESAGEVERSION
node1NotReady56mv1.9.0
node2NotReady56mv1.9.0
node3NotReadymaster58mv1.9.04、使用calico插件,修改CIDR为初始化使用的网段;
...
- name: CALICO_IPV4POOL_CIDR
value: "10.244.0.0/16"# 原 value: "10.244.0.0/16"
...[root@node3 k8s]# kubectl create -f calico.yaml[root@node3 k8s]# kubectl get node
NAMESTATUSROLESAGEVERSION
node1Ready1hv1.9.0
node2Ready1hv1.9.0
node3Readymaster1hv1.9.0[root@node3 k8s]# kubectl get pod --all-namespaces
NAMESPACENAMEREADYSTATUSRESTARTSAGE
kube-systemcalico-etcd-tkmpj1/1Running07m
kube-systemcalico-kube-controllers-559b575f97-2zngp1/1Running1011m
kube-systemcalico-node-6gxx82/2Running1011m
kube-systemcalico-node-rmd7h2/2Running1111m
kube-systemcalico-node-tjwct2/2Running1111m
kube-systemetcd-node31/1Running11h
kube-systemkube-apiserver-node31/1Running11h
kube-systemkube-controller-manager-node31/1Running11h
kube-systemkube-dns-6f4fd4bdf-5vw7d3/3Running31h
kube-systemkube-proxy-d994x1/1Running11h
kube-systemkube-proxy-k2bdk1/1Running11h
kube-systemkube-proxy-ksp6b1/1Running11h
kube-systemkube-scheduler-node31/1Running11h
转载于:https://my.oschina.net/huangweibin/blog/1634169
推荐阅读
- 由浅入深理解AOP
- 【译】20个更有效地使用谷歌搜索的技巧
- mybatisplus如何在xml的连表查询中使用queryWrapper
- MybatisPlus|MybatisPlus LambdaQueryWrapper使用int默认值的坑及解决
- MybatisPlus使用queryWrapper如何实现复杂查询
- iOS中的Block
- Linux下面如何查看tomcat已经使用多少线程
- 使用composer自动加载类文件
- android|android studio中ndk的使用
- 使用协程爬取网页,计算网页数据大小