rancher2.3.3安装(本章节是内网安装,不是外网安装)

1、在玩rancher2时候,最好去看看基础视频与文档(个人建议)
2、准备的工作
①内网服务器什么的就不说了,
②准备好一台可以连接外网的虚拟机 ubuntu或者centos,还有记得安装docker-ce的版本,这个最好参考文档。
③我这里需要用到harbor,后面的也一样需要harbor,
harbor安装1.93:
这个是官方提供的整套需要的文件:
连接:(rancher2.3.3官方提供的需要镜像)

第一步:
直接可以联网的虚拟机上执行==》

#touch rancher-images.sh
#chmod +x  rancher-images.sh

将下面的复制到 rancher-images.sh里面。然后执行 ./ rancher-images.sh

#!/bin/bash
docker pull busybox
docker pull quay.io/jetstack/cert-manager-controller:v0.6.2
docker pull quay.io/jetstack/cert-manager-webhook:v0.6.2
docker pull rancher/calico-cni:v3.4.0
docker pull rancher/calico-cni:v3.7.4
docker pull rancher/calico-cni:v3.8.1
docker pull rancher/calico-ctl:v2.0.0
docker pull rancher/calico-kube-controllers:v3.7.4
docker pull rancher/calico-kube-controllers:v3.8.1
docker pull rancher/calico-node:v3.4.0
docker pull rancher/calico-node:v3.7.4
docker pull rancher/calico-node:v3.8.1
docker pull rancher/calico-pod2daemon-flexvol:v3.8.1
docker pull rancher/cluster-proportional-autoscaler:1.3.0
docker pull rancher/cluster-proportional-autoscaler:1.7.1
docker pull rancher/configmap-reload:v0.3.0-rancher2
docker pull rancher/coredns-coredns:1.1.2
docker pull rancher/coredns-coredns:1.3.1
docker pull rancher/coredns-coredns:1.6.2
docker pull rancher/coreos-configmap-reload:v0.0.1
docker pull rancher/coreos-etcd:v3.3.10-rancher1
docker pull rancher/coreos-etcd:v3.3.15-rancher1
docker pull rancher/coreos-flannel:v0.10.0
docker pull rancher/coreos-flannel:v0.10.0-rancher1
docker pull rancher/coreos-flannel:v0.11.0
docker pull rancher/coreos-flannel:v0.11.0-rancher1
docker pull rancher/coreos-kube-state-metrics:v1.8.0
docker pull rancher/coreos-prometheus-config-reloader:v0.32.0
docker pull rancher/coreos-prometheus-operator:v0.32.0
docker pull rancher/flannel-cni:v0.3.0-rancher5
docker pull rancher/fluentd:v0.1.17
docker pull rancher/grafana-grafana:6.3.6
docker pull rancher/hyperkube:v1.14.8-rancher1
docker pull rancher/hyperkube:v1.14.9-rancher1
docker pull rancher/hyperkube:v1.15.5-rancher1
docker pull rancher/hyperkube:v1.15.6-rancher1
docker pull rancher/hyperkube:v1.16.2-rancher1
docker pull rancher/hyperkube:v1.16.3-rancher1
docker pull rancher/istio-citadel:1.3.3
docker pull rancher/istio-coredns-plugin:0.2-istio-1.1
docker pull rancher/istio-galley:1.3.3
docker pull rancher/istio-kubectl:1.1.5
docker pull rancher/istio-kubectl:1.3.3
docker pull rancher/istio-mixer:1.3.3
docker pull rancher/istio-node-agent-k8s:1.3.3
docker pull rancher/istio-pilot:1.3.3
docker pull rancher/istio-proxy_init:1.3.3
docker pull rancher/istio-proxyv2:1.3.3
docker pull rancher/istio-sidecar_injector:1.3.3
docker pull rancher/jaegertracing-all-in-one:1.12
docker pull rancher/jenkins-jnlp-slave:3.35-4
docker pull rancher/jetstack-cert-manager-controller:v0.6.2
docker pull rancher/k8s-dns-dnsmasq-nanny:1.15.0
docker pull rancher/k8s-dns-kube-dns:1.15.0
docker pull rancher/k8s-dns-sidecar:1.15.0
docker pull rancher/kiali-kiali:v1.4.2
docker pull rancher/kube-api-auth:v0.1.3
docker pull rancher/kubernetes-external-dns:v0.5.11
docker pull rancher/log-aggregator:v0.1.6
docker pull rancher/metrics-server:v0.3.1
docker pull rancher/metrics-server:v0.3.3
docker pull rancher/metrics-server:v0.3.4
docker pull rancher/minio-minio:RELEASE.2019-09-25T18-25-51Z
docker pull rancher/nginx-ingress-controller-defaultbackend:1.5-rancher1
docker pull rancher/nginx-ingress-controller:nginx-0.25.1-rancher1
docker pull rancher/nginx:1.17.4-alpine
docker pull rancher/openzipkin-zipkin:2.14.2
docker pull rancher/pause:3.1
docker pull rancher/pipeline-jenkins-server:v0.1.4
docker pull rancher/pipeline-tools:v0.1.14
docker pull rancher/plugins-docker:18.09
docker pull rancher/prom-alertmanager:v0.17.0
docker pull rancher/prom-node-exporter:v0.17.0
docker pull rancher/prom-prometheus:v2.11.1
docker pull rancher/prometheus-auth:v0.2.0
docker pull rancher/pstauffer-curl:v1.0.3
docker pull rancher/rancher-agent:v2.3.3
docker pull rancher/rancher:v2.3.3
docker pull rancher/rke-tools:v0.1.50
docker pull rancher/rke-tools:v0.1.51
docker pull rancher/security-scan:v0.1.2
docker pull registry:2
exit 0

第二步:
当docker pull所有好镜像,这里可以将镜像推送到harbor上或者下载下来。这里将将镜像下载下来,然后通过WinSCp把下载的镜像传递到内网上。
==》 镜像保存重定向
docker image save 【docker镜像】 > 【docker文件】.tar

# mkdir -p /root/local/rancher-tar && cd /root/local/rancher-tar
# touch ranchertar.sh
# chmod +x ranchertar.sh

复制下面脚本到 ranchertar.sh里面,执行 ./ranchertar.sh

#!/bin/bash

docker image save  busybox  >  busybox.tar
docker image save  quay.io/jetstack/cert-manager-controller:v0.6.2  >  quay.io/jetstack/cert-manager-controller:v0.6.2.tar
docker image save  quay.io/jetstack/cert-manager-webhook:v0.6.2  >  quay.io/jetstack/cert-manager-webhook:v0.6.2.tar
docker image save  rancher/calico-cni:v3.4.0  >  rancher/calico-cni:v3.4.0.tar
docker image save  rancher/calico-cni:v3.7.4  >  rancher/calico-cni:v3.7.4.tar
docker image save  rancher/calico-cni:v3.8.1  >  rancher/calico-cni:v3.8.1.tar
docker image save  rancher/calico-ctl:v2.0.0  >  rancher/calico-ctl:v2.0.0.tar
docker image save  rancher/calico-kube-controllers:v3.7.4  >  rancher/calico-kube-controllers:v3.7.4.tar
docker image save  rancher/calico-kube-controllers:v3.8.1  >  rancher/calico-kube-controllers:v3.8.1.tar
docker image save  rancher/calico-node:v3.4.0  >  rancher/calico-node:v3.4.0.tar
docker image save  rancher/calico-node:v3.7.4  >  rancher/calico-node:v3.7.4.tar
docker image save  rancher/calico-node:v3.8.1  >  rancher/calico-node:v3.8.1.tar
docker image save  rancher/calico-pod2daemon-flexvol:v3.8.1  >  rancher/calico-pod2daemon-flexvol:v3.8.1.tar
docker image save  rancher/cluster-proportional-autoscaler:1.3.0  >  rancher/cluster-proportional-autoscaler:1.3.0.tar
docker image save  rancher/cluster-proportional-autoscaler:1.7.1  >  rancher/cluster-proportional-autoscaler:1.7.1.tar
docker image save  rancher/configmap-reload:v0.3.0-rancher2  >  rancher/configmap-reload:v0.3.0-rancher2.tar
docker image save  rancher/coredns-coredns:1.1.2  >  rancher/coredns-coredns:1.1.2.tar
docker image save  rancher/coredns-coredns:1.3.1  >  rancher/coredns-coredns:1.3.1.tar
docker image save  rancher/coredns-coredns:1.6.2  >  rancher/coredns-coredns:1.6.2.tar
docker image save  rancher/coreos-configmap-reload:v0.0.1  >  rancher/coreos-configmap-reload:v0.0.1.tar
docker image save  rancher/coreos-etcd:v3.3.10-rancher1  >  rancher/coreos-etcd:v3.3.10-rancher1.tar
docker image save  rancher/coreos-etcd:v3.3.15-rancher1  >  rancher/coreos-etcd:v3.3.15-rancher1.tar
docker image save  rancher/coreos-flannel:v0.10.0  >  rancher/coreos-flannel:v0.10.0.tar
docker image save  rancher/coreos-flannel:v0.10.0-rancher1  >  rancher/coreos-flannel:v0.10.0-rancher1.tar
docker image save  rancher/coreos-flannel:v0.11.0  >  rancher/coreos-flannel:v0.11.0.tar
docker image save  rancher/coreos-flannel:v0.11.0-rancher1  >  rancher/coreos-flannel:v0.11.0-rancher1.tar
docker image save  rancher/coreos-kube-state-metrics:v1.8.0  >  rancher/coreos-kube-state-metrics:v1.8.0.tar
docker image save  rancher/coreos-prometheus-config-reloader:v0.32.0  >  rancher/coreos-prometheus-config-reloader:v0.32.0.tar
docker image save  rancher/coreos-prometheus-operator:v0.32.0  >  rancher/coreos-prometheus-operator:v0.32.0.tar
docker image save  rancher/flannel-cni:v0.3.0-rancher5  >  rancher/flannel-cni:v0.3.0-rancher5.tar
docker image save  rancher/fluentd:v0.1.17  >  rancher/fluentd:v0.1.17.tar
docker image save  rancher/grafana-grafana:6.3.6  >  rancher/grafana-grafana:6.3.6.tar
docker image save  rancher/hyperkube:v1.14.8-rancher1  >  rancher/hyperkube:v1.14.8-rancher1.tar
docker image save  rancher/hyperkube:v1.14.9-rancher1  >  rancher/hyperkube:v1.14.9-rancher1.tar
docker image save  rancher/hyperkube:v1.15.5-rancher1  >  rancher/hyperkube:v1.15.5-rancher1.tar
docker image save  rancher/hyperkube:v1.15.6-rancher1  >  rancher/hyperkube:v1.15.6-rancher1.tar
docker image save  rancher/hyperkube:v1.16.2-rancher1  >  rancher/hyperkube:v1.16.2-rancher1.tar
docker image save  rancher/hyperkube:v1.16.3-rancher1  >  rancher/hyperkube:v1.16.3-rancher1.tar
docker image save  rancher/istio-citadel:1.3.3  >  rancher/istio-citadel:1.3.3.tar
docker image save  rancher/istio-coredns-plugin:0.2-istio-1.1  >  rancher/istio-coredns-plugin:0.2-istio-1.1.tar
docker image save  rancher/istio-galley:1.3.3  >  rancher/istio-galley:1.3.3.tar
docker image save  rancher/istio-kubectl:1.1.5  >  rancher/istio-kubectl:1.1.5.tar
docker image save  rancher/istio-kubectl:1.3.3  >  rancher/istio-kubectl:1.3.3.tar
docker image save  rancher/istio-mixer:1.3.3  >  rancher/istio-mixer:1.3.3.tar
docker image save  rancher/istio-node-agent-k8s:1.3.3  >  rancher/istio-node-agent-k8s:1.3.3.tar
docker image save  rancher/istio-pilot:1.3.3  >  rancher/istio-pilot:1.3.3.tar
docker image save  rancher/istio-proxy_init:1.3.3  >  rancher/istio-proxy_init:1.3.3.tar
docker image save  rancher/istio-proxyv2:1.3.3  >  rancher/istio-proxyv2:1.3.3.tar
docker image save  rancher/istio-sidecar_injector:1.3.3  >  rancher/istio-sidecar_injector:1.3.3.tar
docker image save  rancher/jaegertracing-all-in-one:1.12  >  rancher/jaegertracing-all-in-one:1.12.tar
docker image save  rancher/jenkins-jnlp-slave:3.35-4  >  rancher/jenkins-jnlp-slave:3.35-4.tar
docker image save  rancher/jetstack-cert-manager-controller:v0.6.2  >  rancher/jetstack-cert-manager-controller:v0.6.2.tar
docker image save  rancher/k8s-dns-dnsmasq-nanny:1.15.0  >  rancher/k8s-dns-dnsmasq-nanny:1.15.0.tar
docker image save  rancher/k8s-dns-kube-dns:1.15.0  >  rancher/k8s-dns-kube-dns:1.15.0.tar
docker image save  rancher/k8s-dns-sidecar:1.15.0  >  rancher/k8s-dns-sidecar:1.15.0.tar
docker image save  rancher/kiali-kiali:v1.4.2  >  rancher/kiali-kiali:v1.4.2.tar
docker image save  rancher/kube-api-auth:v0.1.3  >  rancher/kube-api-auth:v0.1.3.tar
docker image save  rancher/kubernetes-external-dns:v0.5.11  >  rancher/kubernetes-external-dns:v0.5.11.tar
docker image save  rancher/log-aggregator:v0.1.6  >  rancher/log-aggregator:v0.1.6.tar
docker image save  rancher/metrics-server:v0.3.1  >  rancher/metrics-server:v0.3.1.tar
docker image save  rancher/metrics-server:v0.3.3  >  rancher/metrics-server:v0.3.3.tar
docker image save  rancher/metrics-server:v0.3.4  >  rancher/metrics-server:v0.3.4.tar
docker image save  rancher/minio-minio:RELEASE.2019-09-25T18-25-51Z  >  rancher/minio-minio:RELEASE.2019-09-25T18-25-51Z.tar
docker image save  rancher/nginx-ingress-controller-defaultbackend:1.5-rancher1  >  rancher/nginx-ingress-controller-defaultbackend:1.5-rancher1.tar
docker image save  rancher/nginx-ingress-controller:nginx-0.25.1-rancher1  >  rancher/nginx-ingress-controller:nginx-0.25.1-rancher1.tar
docker image save  rancher/nginx:1.17.4-alpine  >  rancher/nginx:1.17.4-alpine.tar
docker image save  rancher/openzipkin-zipkin:2.14.2  >  rancher/openzipkin-zipkin:2.14.2.tar
docker image save  rancher/pause:3.1  >  rancher/pause:3.1.tar
docker image save  rancher/pipeline-jenkins-server:v0.1.4  >  rancher/pipeline-jenkins-server:v0.1.4.tar
docker image save  rancher/pipeline-tools:v0.1.14  >  rancher/pipeline-tools:v0.1.14.tar
docker image save  rancher/plugins-docker:18.09  >  rancher/plugins-docker:18.09.tar
docker image save  rancher/prom-alertmanager:v0.17.0  >  rancher/prom-alertmanager:v0.17.0.tar
docker image save  rancher/prom-node-exporter:v0.17.0  >  rancher/prom-node-exporter:v0.17.0.tar
docker image save  rancher/prom-prometheus:v2.11.1  >  rancher/prom-prometheus:v2.11.1.tar
docker image save  rancher/prometheus-auth:v0.2.0  >  rancher/prometheus-auth:v0.2.0.tar
docker image save  rancher/pstauffer-curl:v1.0.3  >  rancher/pstauffer-curl:v1.0.3.tar
docker image save  rancher/rancher-agent:v2.3.3  >  rancher/rancher-agent:v2.3.3.tar
docker image save  rancher/rancher:v2.3.3  >  rancher/rancher:v2.3.3.tar
docker image save  rancher/rke-tools:v0.1.50  >  rancher/rke-tools:v0.1.50.tar
docker image save  rancher/rke-tools:v0.1.51  >  rancher/rke-tools:v0.1.51.tar
docker image save  rancher/security-scan:v0.1.2  >  rancher/security-scan:v0.1.2.tar
docker image save  registry:2  >  registry:2.tar
exit 0

就可以看到在 /root/local/rancher-tar里面就下载好了我们刚才需要的镜像。然后压缩通过WinSCP将下载好的镜像rancher-images.tar压缩包复制到内网上。

# cd  /root/local/
# tar -cvf rancher-images.tar rancher-tar

第三步:内网导入镜像
到内网服务器上

# tar -xvf  rancher-images.tar
# touch rancher-load.sh
# chmod +X  rancher-load.sh

将下面代码复制到 rancher-load.sh

#!/bin/bash
docker load <busybox.tar
docker load <quay.io/jetstack/cert-manager-controller:v0.6.2.tar
docker load <quay.io/jetstack/cert-manager-webhook:v0.6.2.tar
docker load <rancher/calico-cni:v3.4.0.tar
docker load <rancher/calico-cni:v3.7.4.tar
docker load <rancher/calico-cni:v3.8.1.tar
docker load <rancher/calico-ctl:v2.0.0.tar
docker load <rancher/calico-kube-controllers:v3.7.4.tar
docker load <rancher/calico-kube-controllers:v3.8.1.tar
docker load <rancher/calico-node:v3.4.0.tar
docker load <rancher/calico-node:v3.7.4.tar
docker load <rancher/calico-node:v3.8.1.tar
docker load <rancher/calico-pod2daemon-flexvol:v3.8.1.tar
docker load <rancher/cluster-proportional-autoscaler:1.3.0.tar
docker load <rancher/cluster-proportional-autoscaler:1.7.1.tar
docker load <rancher/configmap-reload:v0.3.0-rancher2.tar
docker load <rancher/coredns-coredns:1.1.2.tar
docker load <rancher/coredns-coredns:1.3.1.tar
docker load <rancher/coredns-coredns:1.6.2.tar
docker load <rancher/coreos-configmap-reload:v0.0.1.tar
docker load <rancher/coreos-etcd:v3.3.10-rancher1.tar
docker load <rancher/coreos-etcd:v3.3.15-rancher1.tar
docker load <rancher/coreos-flannel:v0.10.0.tar
docker load <rancher/coreos-flannel:v0.10.0-rancher1.tar
docker load <rancher/coreos-flannel:v0.11.0.tar
docker load <rancher/coreos-flannel:v0.11.0-rancher1.tar
docker load <rancher/coreos-kube-state-metrics:v1.8.0.tar
docker load <rancher/coreos-prometheus-config-reloader:v0.32.0.tar
docker load <rancher/coreos-prometheus-operator:v0.32.0.tar
docker load <rancher/flannel-cni:v0.3.0-rancher5.tar
docker load <rancher/fluentd:v0.1.17.tar
docker load <rancher/grafana-grafana:6.3.6.tar
docker load <rancher/hyperkube:v1.14.8-rancher1.tar
docker load <rancher/hyperkube:v1.14.9-rancher1.tar
docker load <rancher/hyperkube:v1.15.5-rancher1.tar
docker load <rancher/hyperkube:v1.15.6-rancher1.tar
docker load <rancher/hyperkube:v1.16.2-rancher1.tar
docker load <rancher/hyperkube:v1.16.3-rancher1.tar
docker load <rancher/istio-citadel:1.3.3.tar
docker load <rancher/istio-coredns-plugin:0.2-istio-1.1.tar
docker load <rancher/istio-galley:1.3.3.tar
docker load <rancher/istio-kubectl:1.1.5.tar
docker load <rancher/istio-kubectl:1.3.3.tar
docker load <rancher/istio-mixer:1.3.3.tar
docker load <rancher/istio-node-agent-k8s:1.3.3.tar
docker load <rancher/istio-pilot:1.3.3.tar
docker load <rancher/istio-proxy_init:1.3.3.tar
docker load <rancher/istio-proxyv2:1.3.3.tar
docker load <rancher/istio-sidecar_injector:1.3.3.tar
docker load <rancher/jaegertracing-all-in-one:1.12.tar
docker load <rancher/jenkins-jnlp-slave:3.35-4.tar
docker load <rancher/jetstack-cert-manager-controller:v0.6.2.tar
docker load <rancher/k8s-dns-dnsmasq-nanny:1.15.0.tar
docker load <rancher/k8s-dns-kube-dns:1.15.0.tar
docker load <rancher/k8s-dns-sidecar:1.15.0.tar
docker load <rancher/kiali-kiali:v1.4.2.tar
docker load <rancher/kube-api-auth:v0.1.3.tar
docker load <rancher/kubernetes-external-dns:v0.5.11.tar
docker load <rancher/log-aggregator:v0.1.6.tar
docker load <rancher/metrics-server:v0.3.1.tar
docker load <rancher/metrics-server:v0.3.3.tar
docker load <rancher/metrics-server:v0.3.4.tar
docker load <rancher/minio-minio:RELEASE.2019-09-25T18-25-51Z.tar
docker load <rancher/nginx-ingress-controller-defaultbackend:1.5-rancher1.tar
docker load <rancher/nginx-ingress-controller:nginx-0.25.1-rancher1.tar
docker load <rancher/nginx:1.17.4-alpine.tar
docker load <rancher/openzipkin-zipkin:2.14.2.tar
docker load <rancher/pause:3.1.tar
docker load <rancher/pipeline-jenkins-server:v0.1.4.tar
docker load <rancher/pipeline-tools:v0.1.14.tar
docker load <rancher/plugins-docker:18.09.tar
docker load <rancher/prom-alertmanager:v0.17.0.tar
docker load <rancher/prom-node-exporter:v0.17.0.tar
docker load <rancher/prom-prometheus:v2.11.1.tar
docker load <rancher/prometheus-auth:v0.2.0.tar
docker load <rancher/pstauffer-curl:v1.0.3.tar
docker load <rancher/rancher-agent:v2.3.3.tar
docker load <rancher/rancher:v2.3.3.tar
docker load <rancher/rke-tools:v0.1.50.tar
docker load <rancher/rke-tools:v0.1.51.tar
docker load <rancher/security-scan:v0.1.2.tar
docker load <registry:2.tar
exit 0

最后一步:启动
如果是单节点,记得不能选择80和443端口,会把rancher自带的nginx的端口占用

HOST_PATH=服务器IP
docker run -d --restart=unless-stopped
-p 8080:80 -p 8443:443
-v $HOST_PATH:/var/lib/rancher
rancher/rancher:v2.3.3

你可能感兴趣的:(It)