Ubuntu 18.04 离线安装Kubernetes v1.11.1

在Ubuntu上使用离线方式快速安装K8S v1.11.1
0、安装包文件下载
v1.11.1 文件大小 630M左右
1、系统环境
系统版本
Ubuntu 18.04 LTS

kubernete v1.11.1
机器数量 x3
配置 1核 2G 20G硬盘
k8s-master001   192.168.98.110

k8s-node001      192.168.98.111

k8s-node002      192.168.98.112
2、准备工作(以下操作在三台机器中进行)
2.1 Ubuntu 18.04 LTS
     默认安装 略
2.2 安装文件传输工具、禁用SWAP、关闭防火墙、关闭SELINUX、配置主机名、IP地址
     sudo -i

     apt install lrzsz -y

     swapoff -a

     sed -i '/ swap / s/^/#/' /etc/fstab

     apt-get update

     apt-get upgrade

     #关闭防火墙、关闭SELINUX、配置主机名、IP地址,步骤略

     reboot
2.3 安装Docker
     tar xzvf docker_v18.03.1_ce.tar.gz

     cd docker_v18.03.1_ce && ./install.sh
2.4 安装Kubeadm等程序
     tar xzvf 002.001.k8s.deb.v1.11.1.tar.gz

     cd k8s.deb.v1.11.1  && ./install.sh
3、安装Kubeadm
3.1  On Master  导入镜像并初始化集群
3.1.1  导入镜像到Master
      tar xzvf 002.002.k8s.master.v1.11.1.tar.gz

      cd k8s.master.v1.11.1 && ./loadall.sh

      tar xzvf 003.kubeadm_init.tar.gz

      cd kubeadm_init  && install.sh  #注意修改脚本中初始化的网络地址

      #通过LOG文件查看客户端加入的命令

      #这时候主应该就可以了。
3.2  On node001 & node002  将NODE加入集群
3.2.1  导入镜像到所有Node
      tar xzvf 002.002.k8s.node.v1.11.1.tar.gz

      cd k8s.node.v1.11.1  && ./loadall.sh
     #使用初始化完成的命令加入集群。
3.3  On Master 安装Dashboard
3.3.1  执行安装脚本
       tar xzvf 004.kubernetes-dashboard.tar.gz

       cd kubernetes-dashboard && ./install.sh
3.4  安装Nginx-ingress
      先在所有节点上安装

      tar xzvf 005.nginx-ingress.tar.gz

      cd nginx-ingress && ./install_on_node.sh

      然在所有Master节点上安装

      tar xzvf 005.nginx-ingress.tar.gz

      cd nginx-ingress && ./install_on_master.sh
3.5  入门命令
      https://kubernetes.io/docs/home/
      http://docs.kubernetes.org.cn/
      略,请自行学习
文章作者:Morphy Hu
原文:https://morphyhu.szitcare.com/wordpress/?p=1139
K8S中文社区微信公众号

评论 8

登录后评论

立即登录  

  1. #8

    谁能告诉我一下,cd kubeadm_init && install.sh #注意修改脚本中初始化的网络地址 这个地址修改成什么?

    绝不能休息6年前 (2018-07-28)
  2. #7

    和你本地网段不同即可

    独孤求败6年前 (2018-07-30)
  3. #6

    root@ubuntugit03:/home/git/k8s.v1.11.1/nginx-ingress# kubeadm join 192.168.20.29:6443 –token octd7p.vmgmveemrf1xus10 –discovery-token-ca-cert-hash sha256:383cca31edd1d624959c21f86fb837c2ae20eace20702229adb454334b388b08
    [preflight] running pre-flight checks
    [WARNING RequiredIPVSKernelModulesAvailable]: the IPVS proxier will not be used, because the following required kernel modules are not loaded: [ip_vs ip_vs_rr ip_vs_wrr ip_vs_sh] or no builtin kernel ipvs support: map[ip_vs_rr:{} ip_vs_wrr:{} ip_vs_sh:{} nf_conntrack_ipv4:{} ip_vs:{}]
    you can solve this problem with following methods:
    1. Run ‘modprobe — ‘ to load missing kernel modules;
    2. Provide the missing builtin kernel ipvs support

    I0822 19:52:57.328622 28713 kernel_validator.go:81] Validating kernel version
    I0822 19:52:57.328938 28713 kernel_validator.go:96] Validating kernel config
    [WARNING SystemVerification]: docker version is greater than the most recently validated version. Docker version: 18.03.1-ce. Max validated version: 17.03
    [discovery] Trying to connect to API Server “192.168.20.29:6443”
    [discovery] Created cluster-info discovery client, requesting info from “https://192.168.20.29:6443”
    [discovery] Requesting info from “https://192.168.20.29:6443” again to validate TLS against the pinned public key
    [discovery] Cluster info signature and contents are valid and TLS certificate validates against pinned roots, will use API Server “192.168.20.29:6443”
    [discovery] Successfully established connection with API Server “192.168.20.29:6443”
    [kubelet] Downloading configuration for the kubelet from the “kubelet-config-1.11” ConfigMap in the kube-system namespace
    Unauthorized

    你好这个错误是什么原因呢?

    菜鸟专家6年前 (2018-08-23)
  4. #5

    节点加入的时候提示Unauthorized是什么原因呢
    [discovery] Requesting info from “https://192.168.20.29:6443” again to validate TLS against the pinned public key
    [discovery] Cluster info signature and contents are valid and TLS certificate validates against pinned roots, will use API Server “192.168.20.29:6443”
    [discovery] Successfully established connection with API Server “192.168.20.29:6443”
    [kubelet] Downloading configuration for the kubelet from the “kubelet-config-1.11” ConfigMap in the kube-system namespace
    Unauthorized

    菜鸟专家6年前 (2018-08-23)
  5. #4

    其他都正常,但是Dashboard死活启动不了,不知道哪里出问题了……
    2018/09/09 02:16:15 Using apiserver-host location: http://192.168.0.80:8080
    2018/09/09 02:16:15 Skipping in-cluster config
    2018/09/09 02:16:15 Using random key for csrf signing
    2018/09/09 02:16:15 No request provided. Skipping authorization
    2018/09/09 02:16:15 Starting overwatch
    2018/09/09 02:16:45 Error while initializing connection to Kubernetes apiserver. This most likely means that the cluster is misconfigured (e.g., it has invalid apiserver certificates or service accounts configuration) or the –apiserver-host param points to a server that does not exist. Reason: Get http://192.168.0.80:8080/version: dial tcp 192.168.0.80:8080: i/o timeout
    Refer to our FAQ and wiki pages for more information: https://github.com/kubernetes/dashboard/wiki/FAQ

    Tony6年前 (2018-09-09)
  6. #3

    Dashboard死活启动不了

    apm70plus6年前 (2018-10-09)
  7. #2

    请问怎么在配置文件种设置master ip,我之前的初始化的时候自动生成的一块桥接网卡的IP地址,我想使用知道IP作为master的IP地址

    mrwuzs6年前 (2018-10-17)
  8. #1

    ubuntu 14.04 可以安装吗?

    VPS2345年前 (2019-01-18)