标签:dir uber gis ble serve boot 相关 wap rgs
由于各种各样的原因,你可能需要离线安装,至于为什么不是通过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
至此就完成了
纯粹记录,如果按照文档装不上或者某些命令式很正常的。
标签:dir uber gis ble serve boot 相关 wap rgs
原文地址:https://blog.51cto.com/youerning/2436197