如何在 Ubuntu 14 中安装最新的生产级 Kubernetes [英] How to install latest production-level Kubernetes in Ubuntu 14
问题描述
1. 遵循 ->
3. 最后,我在 Ubuntu 16
和 kubeadm
中进行了尝试.https://kubernetes.io/docs/getting-started-guides/kubeadm/
kubeadm init
命令成功完成,没有任何问题,但是当我尝试 kubectl cluster-info
时,它显示 与服务器 localhost 的连接:8080 被拒绝
有什么帮助吗?(主要是我想在 Ubuntu 14 中安装 K8)
更新 1
第 3 点(带有 kubeadm
的 Ubuntu 16 上的 K8)通过运行解决
sudo cp/etc/kubernetes/admin.conf $HOME/须藤 chown $(id -u):$(id -g) $HOME/admin.conf导出 KUBECONFIG=$HOME/admin.conf
我玩得很开心 :-)
因此,Ubuntu 14.04 上的 Kubernetes 1.6.4(可信赖):
- 有
nsenter
内置 &已安装(nsenter
是一个硬的kubelet
依赖项,在 14.04 中不存在) - 修补
kubelet
和kubeadm
包以移除 systemd 依赖(并用upstart
脚本替换它) - 在
kubeadm init
期间手动启动kubelet
(因为kubeadm
只支持systemd风格的init系统)
我已经为上述内容创建了一个概念验证脚本.它可以在:https://gist.github.com/lenartj/0b264cb70e6cb504df833cb5054def8-kubernetes-sh
您可以按照官方指南安装 kubeadm 和 创建集群.只需跳过 kubeadm
和 kubelet
安装步骤并使用上面的脚本.
有一个演示:https://asciinema.org/a/124160
步骤是:
- 安装docker:
curl -sSL https://get.docker.com/|sh
- 安装apt-transport-https:
apt-get update &&apt-get install -y apt-transport-https
- 添加 kubernetes 存储库密钥:
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg |apt-key a
- 添加 kubernetes-xenial 存储库:
echo 'deb http://apt.kubernetes.io/kubernetes-xenial main' >/etc/apt/sources.list.d/kubernetes.list
- 安装kubectl、kubernetes-cni以及kubelet的依赖:
apt-get install -y kubectl kubernetes-cni binutils ebtables socat
- 运行脚本以创建 kubelet 和 kubeadm 包以及 nsenter 二进制文件:
curl -sSL https://gist.github.com/lenartj/0b264cb70e6cb50dfdef37084f892554#file-trusty-kubernetes-sh |bash
- 安装 nsenter 二进制文件:
cp -v/tmp/tmp.xxxxx/nsenter/usr/local/bin
- 安装 kubelet 和 kubeadm 包:
dpkg -i/tmp/tmp.xxxxx/*-patched
- 初始化master:
kubeadm init
- 启动 kubelet(同时 kubeadm 正在等待控制平面):
service kubelet start
- 配置 kubectl 管理员凭据:
cp/etc/kubernetes/admin.conf $HOME/;chown $(id -u):$(id -g) $HOME/admin.conf;export KUBECONFIG=$HOME/admin.conf
- 安装 Pod 网络(weave-net):
kubectl apply -f https://git.io/weave-kube-1.6
这不是一个很好的 &干净的解决方案,但它有效.
1. Followed -> https://kubernetes.io/docs/getting-started-guides/ubuntu/manual/
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.
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
Outdated Documentation?
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. Finally I tried in Ubuntu 16
with kubeadm
.https://kubernetes.io/docs/getting-started-guides/kubeadm/
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
Any help?(Mainly I want to install K8 in Ubuntu 14)
UPDATE 1
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
I have had some fun with this :-)
So, Kubernetes 1.6.4 on Ubuntu 14.04 (Trusty):
- have
nsenter
built & installed (nsenter
is a hardkubelet
dependency and is not present in 14.04) - patch up the
kubelet
andkubeadm
packages to remove the systemd dependency (and repace it with anupstart
script) - start
kubelet
manually duringkubeadm init
(becausekubeadm
only supports the systemd-style init system)
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
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.
There is a demo at: https://asciinema.org/a/124160
The steps are:
- Install docker:
curl -sSL https://get.docker.com/ | sh
- Install apt-transport-https:
apt-get update && apt-get install -y apt-transport-https
- Add kubernetes repository key:
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key a
- Add kubernetes-xenial repository:
echo 'deb http://apt.kubernetes.io/ kubernetes-xenial main' >/etc/apt/sources.list.d/kubernetes.list
- Install kubectl, kubernetes-cni and dependencies of kubelet:
apt-get install -y kubectl kubernetes-cni binutils ebtables socat
- 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
- Install the nsenter binary:
cp -v /tmp/tmp.xxxxx/nsenter /usr/local/bin
- Install kubelet and kubeadm packages:
dpkg -i /tmp/tmp.xxxxx/*-patched
- Initialize the master:
kubeadm init
- Start the kubelet (while kubeadm is waiting for the control plane):
service kubelet start
- Configure kubectl admin credentials:
cp /etc/kubernetes/admin.conf $HOME/; chown $(id -u):$(id -g) $HOME/admin.conf; export KUBECONFIG=$HOME/admin.conf
- 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屋!