如何在Ubuntu 14中安装最新的生产级Kubernetes [英] How to install latest production-level Kubernetes in Ubuntu 14

查看:153
本文介绍了如何在Ubuntu 14中安装最新的生产级Kubernetes的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1.关注-> https://kubernetes.io/docs/getting-started-guides/ubuntu/manual/

我克隆了他们在文档中提到的内容. git clone --depth 1 https://github.com/kubernetes/kubernetes.git.我找不到文件cluster/ubuntu/config-default.sh来配置集群.

After I clone as they mentioned in doc. git clone --depth 1 https://github.com/kubernetes/kubernetes.git. I could not find the file cluster/ubuntu/config-default.sh to configure cluster.

好,我将其保留为默认值并尝试运行KUBERNETES_PROVIDER=ubuntu ./kube-up.sh,但是没有verify-kube-binaries.sh文件

Ok, I left it default and try to run KUBERNETES_PROVIDER=ubuntu ./kube-up.sh but there is no verify-kube-binaries.sh file

root@ultron:/home/veeru# KUBERNETES_PROVIDER=ubuntu ./kube-up.sh
... Starting cluster using provider: ubuntu
... calling verify-prereqs
Skeleton Provider: verify-prereqs not implemented
... calling verify-kube-binaries
./kube-up.sh: line 44: verify-kube-binaries: command not found

过时的文档?

2..我已从官方 git repo 下载了1.6.4.版本(Branch-> Tag-> v1.6.4) 配置cluster/ubuntu/config-default.sh之后,我在cluster目录中运行了KUBERNETES_PROVIDER=ubuntu ./kube-up.sh.但是有些链接已经过时了!

2. From official git repo, I have downloaded 1.6.4 version (Branch->Tag->v1.6.4) After cluster/ubuntu/config-default.sh configuration I ran KUBERNETES_PROVIDER=ubuntu ./kube-up.sh in cluster directory. But some of the links are outdated!

3..最后,我在Ubuntu 16中尝试了kubeadm. https://kubernetes.io/docs/getting-started-guides/kubeadm/

3. Finally I tried in Ubuntu 16 with kubeadm.https://kubernetes.io/docs/getting-started-guides/kubeadm/

kubeadm init命令成功完成,没有任何问题,但是当我尝试kubectl cluster-info时,它显示The connection to the server localhost:8080 was refused

The kubeadm init command successfully completed without any problem, but when I try to kubectl cluster-info, it is showing The connection to the server localhost:8080 was refused

有帮助吗?(主要是我想在Ubuntu 14中安装K8)

Any help?(Mainly I want to install K8 in Ubuntu 14)

更新1

第3点(在具有kubeadm的Ubuntu 16上为K8)通过运行来解决

Point 3(K8 on Ubuntu 16 with kubeadm) is resolved by running

  sudo cp /etc/kubernetes/admin.conf $HOME/
  sudo chown $(id -u):$(id -g) $HOME/admin.conf
  export KUBECONFIG=$HOME/admin.conf

推荐答案

我对此很有趣:-)

因此,在Ubuntu 14.04(Trusty)上的Kubernetes 1.6.4:

So, Kubernetes 1.6.4 on Ubuntu 14.04 (Trusty):

  • 具有nsenter内置的&已安装(nsenter是硬性kubelet依赖项,在14.04中不存在)
  • 修补kubeletkubeadm软件包以删除systemd依赖项(并使用upstart脚本对其进行回复)
  • kubeadm init期间手动启动kubelet(因为kubeadm仅支持systemd样式的初始化系统)
  • have nsenter built & installed (nsenter is a hard kubelet dependency and is not present in 14.04)
  • patch up the kubelet and kubeadm packages to remove the systemd dependency (and repace it with an upstart script)
  • start kubelet manually during kubeadm init (because kubeadm only supports the systemd-style init system)

我已经针对上述内容创建了概念证明脚本.可在以下位置获得: https://gist.github.com/lenartj/0b264cb70e6cb50dfdef37084f892554#file-trusty -kubernetes-sh

I've created a proof of concept script to the above. It's available at: https://gist.github.com/lenartj/0b264cb70e6cb50dfdef37084f892554#file-trusty-kubernetes-sh

您可以按照官方指南安装kubeadm 创建集群.只需跳过kubeadmkubelet安装步骤,而使用上面的脚本即可.

You can follow the official guide installing kubeadm and creating the cluster. Just skip the kubeadm and kubelet installation steps and use the script above instead.

在以下位置有一个演示: https://asciinema.org/a/124160

There is a demo at: https://asciinema.org/a/124160

步骤是:

  1. 安装docker:curl -sSL https://get.docker.com/ | sh
  2. 安装apt-transport-https:apt-get update && apt-get install -y apt-transport-https
  3. 添加kubernetes存储库密钥:curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key a
  4. 添加kubernetes- xenial 存储库:echo 'deb http://apt.kubernetes.io/ kubernetes-xenial main' >/etc/apt/sources.list.d/kubernetes.list
  5. 安装kubectl,kubernetes-cni和kubelet的依赖项:apt-get install -y kubectl kubernetes-cni binutils ebtables socat
  6. 运行脚本以创建kubelet和kubeadm软件包以及nsenter二进制文件:curl -sSL https://gist.github.com/lenartj/0b264cb70e6cb50dfdef37084f892554#file-trusty-kubernetes-sh | bash
  7. 安装nsenter二进制文件:cp -v /tmp/tmp.xxxxx/nsenter /usr/local/bin
  8. 安装kubelet和kubeadm软件包:dpkg -i /tmp/tmp.xxxxx/*-patched
  9. 初始化主机:kubeadm init
  10. 启动kubelet(在kubeadm等待控制平面时):service kubelet start
  11. 配置kubectl管理员凭据:cp /etc/kubernetes/admin.conf $HOME/; chown $(id -u):$(id -g) $HOME/admin.conf; export KUBECONFIG=$HOME/admin.conf
  12. 安装Pod网络(网络):kubectl apply -f https://git.io/weave-kube-1.6
  1. Install docker: curl -sSL https://get.docker.com/ | sh
  2. Install apt-transport-https: apt-get update && apt-get install -y apt-transport-https
  3. Add kubernetes repository key: curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key a
  4. Add kubernetes-xenial repository: echo 'deb http://apt.kubernetes.io/ kubernetes-xenial main' >/etc/apt/sources.list.d/kubernetes.list
  5. Install kubectl, kubernetes-cni and dependencies of kubelet: apt-get install -y kubectl kubernetes-cni binutils ebtables socat
  6. Run the script to create the kubelet and kubeadm packages and the nsenter binary: curl -sSL https://gist.github.com/lenartj/0b264cb70e6cb50dfdef37084f892554#file-trusty-kubernetes-sh | bash
  7. Install the nsenter binary: cp -v /tmp/tmp.xxxxx/nsenter /usr/local/bin
  8. Install kubelet and kubeadm packages: dpkg -i /tmp/tmp.xxxxx/*-patched
  9. Initialize the master: kubeadm init
  10. Start the kubelet (while kubeadm is waiting for the control plane): service kubelet start
  11. Configure kubectl admin credentials: cp /etc/kubernetes/admin.conf $HOME/; chown $(id -u):$(id -g) $HOME/admin.conf; export KUBECONFIG=$HOME/admin.conf
  12. Install Pod networking (weave-net): kubectl apply -f https://git.io/weave-kube-1.6

这不是一个很好的&干净的解决方案,但是可以.

It's not a nice & clean solution but it works.

这篇关于如何在Ubuntu 14中安装最新的生产级Kubernetes的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆