您好,登錄后才能下訂單哦!
由于各種各樣的原因,你可能需要離線安裝,至于為什么不是通過apt或者yum安裝,這個原因就看具體情況了。
這里主要指rpm包的操作系統,比如centos, fedora之類的。
這里安裝v1.14.1版本的kubernetes, cni選擇flannel.
yum install conntrack-tools socat ebtables
groupadd docker
useradd -g docker docker
可能的配置/etc/default/grub -> GRUB_CMDLINE_LINUX_DEFAULT
cgroup_enable=memory swapaccount=1
取消swap
編輯/etc/fstab, 將含有swap字段的那行注釋掉
最后重啟
下載kubeadm,kubectl, kubelet, kubernetes-cni, docker-ce, kube-flannel.yml
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.14.1/bin/linux/amd64/kubeadm
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.14.1/bin/linux/amd64/kubelet
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.14.1/bin/linux/amd64/kubectl
curl -LO https://download.docker.com/linux/static/stable/x86_64/docker-18.06.3-ce.tgz
curl -LO https://github.com/containernetworking/plugins/releases/download/v0.8.2/cni-plugins-linux-amd64-v0.8.2.tgz
curl -LO https://raw.githubusercontent.com/coreos/flannel/62e44c867a2846fefb68bd5f178daf4da3095ccb/Documentation/kube-flannel.yml
chmod +x kube*
mv kube* /usr/local/bin/
mkdir -p /opt/cni/bin
tar xf cni-plugins-linux-amd64-v0.8.2.tgz -C /opt/cni/bin
配置kubelet服務
cat > /usr/lib/systemd/system/kubelet.service << EOF
[Unit]
Description=kubelet: The Kubernetes Node Agent
Documentation=https://kubernetes.io/docs/
[Service]
ExecStart=/usr/local/bin/kubelet
Restart=always
StartLimitInterval=0
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
配置kubeadm環境變量
cat > /etc/systemd/system/kubelet.service.d/10-kubeadm.conf << EOF
# Note: This dropin only works with kubeadm and kubelet v1.11+
[Service]
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml"
# This is a file that "kubeadm init" and "kubeadm join" generates at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically
EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env
# This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use
# the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file.
EnvironmentFile=-/etc/sysconfig/kubelet
ExecStart=
ExecStart=/usr/local/bin/kubelet \$KUBELET_KUBECONFIG_ARGS \$KUBELET_CONFIG_ARGS \$KUBELET_KUBEADM_ARGS \$KUBELET_EXTRA_ARGS
EOF
讓kublet服務隨系統啟動
systemctl enable kubelet
tar xf docker-17.09.1-ce.tgz
mv docker/* /usr/local/bin/
配置docker服務
cat > /usr/lib/systemd/system/docker.service
[Unit]
Description=docker: docker
[Service]
ExecStart=/usr/local/bin/dockerd
Restart=always
StartLimitInterval=0
RestartSec=10
[Install]
WantedBy=multi-user.target
啟動docker服務并隨系統啟動
systemctl enable docker
systemctl start docker
通過docker pull 命令下載以下docker鏡像:
k8s.gcr.io/kube-apiserver:v1.14.1
k8s.gcr.io/kube-controller-manager:v1.14.1
k8s.gcr.io/kube-scheduler:v1.14.1
k8s.gcr.io/kube-proxy:v1.14.1
k8s.gcr.io/pause:3.1
k8s.gcr.io/etcd:3.3.10
k8s.gcr.io/coredns:1.3.1
https://raw.githubusercontent.com/coreos/flannel/62e44c867a2846fefb68bd5f178daf4da3095ccb/Documentation/kube-flannel.yml
quay.io/coreos/flannel:v0.11.0-amd64
這些相關鏡像版本可以通過以下命令列出,
kubeadm config images list
kubeadm init -v=8 --alsologtostderr
配置自己的admin.conf
mkdir -p $HOME/.kube
cp -i /etc/kubernetes/admin.comf $HOME/.kube
讓自身可調度
kubectl taint node hostname
node-role.kubernetes.io/master=-
配置pod cidr網絡
編輯/etc/kubernetes/manifests/kube-controller-manager.yaml文件, 在command那項加入
--allocate-node-cidrs=true
--cluster-cidr=10.244.0.0/16
重啟kubelet
systemctl restart kubelet
kubectl apply -f kube-flannel.yml
至此就完成了
純粹記錄,如果按照文檔裝不上或者某些命令式很正常的。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。