Last active
July 12, 2018 08:47
-
-
Save novohool/4c9d49174bf198103d1c8d963c796a17 to your computer and use it in GitHub Desktop.
kubernetes离线版本安装,无需自己镜像
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 关于 | |
了解k8s [kubernets整体结构](https://www.kubernetes.org.cn/4047.html) | |
## 离线包地址 | |
使用前注意个版本的依赖 | |
搜索关键词查看:External Dependencies | |
``` | |
https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.11.md | |
https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.10.md | |
https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.9.md | |
https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.8.md | |
https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.7.md | |
https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.6.md | |
https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.5.md | |
https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.4.md | |
https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.3.md | |
https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.2.md | |
``` | |
## 部署实例 | |
以1.10为例 | |
``` | |
https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.10.md | |
``` | |
百度网盘地址: | |
``` | |
链接:https://pan.baidu.com/s/1Q5fzs7-lcSu8iTLQTcNssQ 密码:3g75 | |
``` | |
mkdir -p /opt/ && cd /opt/ | |
先需要装docker服务 | |
``` | |
{ | |
yum install -y yum-utils device-mapper-persistent-data lvm2 epel-release pigz | |
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo | |
yum makecache fast | |
yum -y install docker-ce-selinux-17.03.0.ce-1.el7.centos docker-ce-17.03.0.ce | |
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://a004e50b.m.daocloud.io | |
service docker start | |
} | |
``` | |
### master: | |
``` | |
cd kubernetes/server | |
yum -y install etcd&& service etcd start | |
yum -y install screen | |
/usr/bin/screen -S kube-apiserver | |
bin/kube-apiserver --cert-dir=etc/kubernetes/cert --insecure-bind-address=0.0.0.0 --insecure-port=18080 --service-cluster-ip-range=10.0.0.0/16 --etcd-servers=http://127.0.0.1:2379 --logtostderr=true --allow-privileged=true --allow-privileged=true | |
/usr/bin/screen -S kube-controller-manager | |
bin/kube-controller-manager --master=127.0.0.1:18080 --service-account-private-key-file=etc/kubernetes/cert/apiserver.key --root-ca-file=etc/kubernetes/cert/apiserver.crt --logtostderr=true | |
/usr/bin/screen -S kube-scheduler | |
bin/kube-scheduler --master=127.0.0.1:18080 | |
``` | |
### 检测【适用node节点】 | |
``` | |
bin/kubectl -s 127.0.0.1:18080 get ep -n kube-system | |
bin/kubectl -s 127.0.0.1:18080 get cs | |
bin/kubectl -s 127.0.0.1:18080 get all -o wide --all-namespaces | |
``` | |
### node: | |
注意: | |
127.0.0.1:18080 这个地址一直是kube-apiserver的地址 | |
这里node和master都能签发证书 | |
``` | |
cd kubernetes/node | |
mkdir -p etc/kubernetes/cert | |
KUBE_APISERVER="http://127.0.0.1:18080" | |
bin/kubectl config set-cluster kubernetes --server=$KUBE_APISERVER --kubeconfig=etc/kubernetes/kubelet.kubeconfig | |
bin/kubectl config set-context default --cluster=kubernetes --user=default-noauth --kubeconfig=etc/kubernetes/kubelet.kubeconfig | |
bin/kubectl config use-context default --kubeconfig=etc/kubernetes/kubelet.kubeconfig | |
bin/kubectl config view --kubeconfig=etc/kubernetes/kubelet.kubeconfig | |
cat >etc/kubernetes/kubelet.config.yaml<<EOF | |
kind: KubeletConfiguration | |
apiVersion: kubelet.config.k8s.io/v1beta1 | |
cgroupDriver: cgroupfs | |
EOF | |
/usr/bin/screen -S kubelet | |
bin/kubelet --cert-dir=etc/kubernetes/cert --kubeconfig=etc/kubernetes/kubelet.kubeconfig --config=etc/kubernetes/kubelet.config.yaml --pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure:latest --runtime-cgroups=/systemd/system.slice --kubelet-cgroups=/systemd/system.slice --logtostderr=true --fail-swap-on=false --allow_privileged=true | |
/usr/bin/screen -S kube-proxy | |
bin/kube-proxy --master=127.0.0.1:18080 --proxy-mode=iptables --logtostderr=true | |
``` | |
## 部署测试 | |
``` | |
bin/kubectl -s 127.0.0.1:18080 run linux --image=jingslunt/linux --port=5701 | |
``` | |
使用yml测试 | |
``` | |
https://hub.docker.com/r/jingslunt/linux/ | |
``` | |
## 网络部署 calico kube-dns ingress | |
### calico: | |
``` | |
wget 'https://github.com/projectcalico/calico/releases/download/v2.6.7/release-v2.6.7.tgz' | |
tar -zxvf release-v2.6.7.tgz && cd release-v2.6.7 | |
for i in `ls images/`;do docker load < images/$i;done | |
docker images|grep calico|awk '{print "docker tag "$3" quay.io/"$1":"$2}' | |
cat calico.yaml|grep 2379 【修改etcd服务地址】 | |
etcd_endpoints: "http://127.0.0.1:2379" | |
kubectl -s 127.0.0.1:18080 create -f k8s-manifests/hosted/calico.yaml | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment