Docker 编排工具Rancher 1.6.18
使用docker获取rancher
[root@localhost /]# docker pull rancher/server:stable [root@localhost /]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/hongdada/docker-centos latest bd4403c66e5e 11 hours ago 595 MB docker.io/nginx latest 5699ececb21c 9 days ago 109 MB docker.io/ubuntu 16.04 5e8b97a2a082 4 weeks ago 114 MB docker.io/rancher/server stable 85b3b338d0be 4 weeks ago 1.08 GB docker.io/tomcat latest 33e02377a00f 2 months ago 554 MB docker.io/centos 7.2.1511 0a2bad7da9b5 8 months ago 195 MB
可以看出rancher体积还是比较大的,有1个G
安装:
[root@localhost /]# docker run -d --restart=unless-stopped -p 8888:8080 rancher/server:stable 405098f5d97988758134da5d3f5c755c8745838a15777034721eed72c94d6a02 [root@localhost /]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 405098f5d979 rancher/server:stable "/usr/bin/entry /u..." 7 seconds ago Up 4 seconds 3306/tcp, 0.0.0.0:8888->8080/tcp relaxed_wescoff
按照上面的,打开对应的8888端口就可以访问到rancher页面
添加主机:
我本地是使用的虚拟机,重新克隆了一份,新主机ip为192.168.52.128
再次查看主机内部的docker:
[root@localhost hongdada]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/hongdada/docker-centos latest bd4403c66e5e 13 hours ago 595 MB docker.io/nginx latest 5699ececb21c 9 days ago 109 MB docker.io/ubuntu 16.04 5e8b97a2a082 4 weeks ago 114 MB docker.io/rancher/net v0.13.13 5a271da7cb72 8 weeks ago 310 MB docker.io/tomcat latest 33e02377a00f 2 months ago 554 MB docker.io/rancher/agent v1.2.10 6023e1a77132 3 months ago 237 MB docker.io/rancher/dns v0.17.3 af151d7fa0e8 3 months ago 243 MB docker.io/rancher/healthcheck v0.3.6 db2d1e6261f3 3 months ago 385 MB docker.io/rancher/metadata v0.10.2 77299bd2078e 5 months ago 245 MB docker.io/rancher/network-manager v0.7.20 eaf2cdb14863 5 months ago 256 MB docker.io/rancher/scheduler v0.8.3 3e640a41799a 6 months ago 242 MB docker.io/centos 7.2.1511 0a2bad7da9b5 8 months ago 195 MB docker.io/rancher/net holder 665d9f6e8cc1 15 months ago 267 MB [root@localhost hongdada]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES f8cc8d905ac9 rancher/healthcheck:v0.3.6 "/.r/r /rancher-en..." 3 minutes ago Up 3 minutes r-healthcheck-healthcheck-1-a09c6e05 a7c07c0070bb rancher/dns:v0.17.3 "/rancher-entrypoi..." 3 minutes ago Up 3 minutes r-network-services-metadata-dns-1-a2ed7714 9f8e9029dcab rancher/net:v0.13.13 "/rancher-entrypoi..." 3 minutes ago Up 3 minutes r-ipsec-ipsec-router-1-fb306133 a7cc7b763c35 rancher/net:v0.13.13 "/rancher-entrypoi..." 3 minutes ago Up 3 minutes r-ipsec-ipsec-connectivity-check-1-a26c3db5 0c09403c3624 rancher/net:holder "/.r/r /rancher-en..." 3 minutes ago Up 3 minutes r-ipsec-ipsec-1-b6e2afbc 13245a558e41 rancher/network-manager:v0.7.20 "/rancher-entrypoi..." 3 minutes ago Up 3 minutes r-network-services-network-manager-1-852edd6d 29ba06f2fa7e rancher/metadata:v0.10.2 "/rancher-entrypoi..." 3 minutes ago Up 3 minutes r-network-services-metadata-1-5469cf59 460c27a70adf rancher/net:v0.13.13 "/rancher-entrypoi..." 3 minutes ago Up 3 minutes r-ipsec-cni-driver-1-2d61af01 3bc6a13a6467 rancher/scheduler:v0.8.3 "/.r/r /rancher-en..." 3 minutes ago Up 3 minutes r-scheduler-scheduler-1-e4962c96 2d9171735c9c rancher/agent:v1.2.10 "/run.sh run" 4 minutes ago Up 4 minutes rancher-agent
发现添加主机以后,rancher会自动添加很多容器
创建容器:
查看主机:(只显示redis的)
[root@localhost hongdada]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/redis latest 71a81cb279e3 9 days ago 83.4 MB [root@localhost hongdada]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 17fdb5686e39 redis "/.r/r docker-entr..." 51 seconds ago Up 50 seconds r-redis-2-6e9bf620
使用Redis Desktop Manager连接192.168.52.128:6379,连接成功!
容器界面:
Kubernetes环境:
在Rancher的环境管理中添加Kubernetes环境,并添加对应主机
打开Kubernetes的ui界面
再次查看对应主机的镜像和容器
添加了很多Kubernetes的系统镜像,系统容器
[root@localhost hongdada]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/rancher/k8s v1.10.3-rancher1-1 39c330dd42dc 5 weeks ago 1.68 GB docker.io/rancher/kubectld v0.8.7 7a13fc117413 3 months ago 454 MB docker.io/rancher/kubernetes-agent v0.6.7 752a77ffead6 3 months ago 328 MB docker.io/rancher/kubernetes-dashboard-amd64 v1.8.3 0c60bcf89900 4 months ago 102 MB docker.io/rancher/k8s-dns-kube-dns-amd64 1.14.8 80cc5ea4b547 6 months ago 50.5 MB docker.io/rancher/heapster-amd64 v1.5.0 86a0ddc3a8c2 6 months ago 75.3 MB docker.io/rancher/lb-service-rancher v0.7.17 b7fa6b9cb097 7 months ago 361 MB docker.io/rancher/heapster-influxdb-amd64 v1.3.3 577260d221db 10 months ago 12.5 MB docker.io/rancher/heapster-grafana-amd64 v4.4.3 8cb3de219af7 10 months ago 152 MB docker.io/rancher/kubernetes-auth v0.0.8 ea0a0fa94c0c 10 months ago 293 MB docker.io/rancher/etcd v2.3.7-13 6c21cf015451 11 months ago 57.2 MB docker.io/rancher/etc-host-updater v0.0.3 da6f714674e6 11 months ago 241 MB docker.io/rancher/pause-amd64 3.0 99e59f495ffa 2 years ago 747 kB [root@localhost hongdada]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES f06b4e933733 docker.io/rancher/tiller@sha256:9b373c71ea2dfdb7d42a6c6dada769cf93be682df7cfabb717748bdaef27d10a "/tiller --v=2" 5 seconds ago Up Less than a second k8s_tiller_tiller-deploy-6ffff75db6-p7v5q_kube-system_b11e2bf6-813a-11e8-beaa-0277d64a57f7_0 440d2bb54f87 docker.io/rancher/heapster-amd64@sha256:25e47d10baaa53a3f24ee8768269bbff635543aba7d397a8275d83ad92fa8cb3 "/heapster --sourc..." 16 seconds ago Up 13 seconds k8s_heapster_heapster-6cfb49f776-m9cdz_kube-system_a0a1c958-813a-11e8-beaa-0277d64a57f7_0 a6b670be3e28 docker.io/rancher/heapster-influxdb-amd64@sha256:fc5cb5dec62a1ce562c62dc81c9bdf8c219a8dc9fc5c47af01fb36cdf7d1504e "influxd --config ..." 41 seconds ago Up 39 seconds k8s_influxdb_monitoring-influxdb-6fc88bd58d-7t4zg_kube-system_aabd590d-813a-11e8-beaa-0277d64a57f7_0 05fcea73c9e5 docker.io/rancher/heapster-grafana-amd64@sha256:714c2cb50410fd2c88bb6fae7e36e8d5da4490788c6346dfef229ec774b4711f "/run.sh" 48 seconds ago Up 46 seconds k8s_grafana_monitoring-grafana-76f5b489d5-cbkgs_kube-system_9df613c2-813a-11e8-beaa-0277d64a57f7_0 09d18e4d0916 docker.io/rancher/k8s-dns-kube-dns-amd64@sha256:6d8e0da4fb46e9ea2034a3f4cab0e095618a2ead78720c12e791342738e5f85d "/kube-dns --domai..." About a minute ago Up About a minute k8s_kubedns_kube-dns-75c8cb4ccb-4p2j6_kube-system_9a216ee8-813a-11e8-beaa-0277d64a57f7_0 5942ac630d41 docker.io/rancher/kubernetes-dashboard-amd64@sha256:050620264fb56824b1bc1b9876f9c17875d96bb9fb96d5c34027ddbf65786f62 "/dashboard --inse..." About a minute ago Up About a minute k8s_kubernetes-dashboard_kubernetes-dashboard-6f4c8b9cd5-cfcks_kube-system_9545a372-813a-11e8-beaa-0277d64a57f7_0 f89f191ba344 rancher/pause-amd64:3.0 "/pause" About a minute ago Up About a minute k8s_POD_tiller-deploy-6ffff75db6-p7v5q_kube-system_b11e2bf6-813a-11e8-beaa-0277d64a57f7_0 81ce204219c9 rancher/pause-amd64:3.0 "/pause" About a minute ago Up About a minute k8s_POD_monitoring-influxdb-6fc88bd58d-7t4zg_kube-system_aabd590d-813a-11e8-beaa-0277d64a57f7_0 8a351b7c19cb rancher/pause-amd64:3.0 "/pause" About a minute ago Up About a minute k8s_POD_heapster-6cfb49f776-m9cdz_kube-system_a0a1c958-813a-11e8-beaa-0277d64a57f7_1 c9f17ef6fe37 rancher/pause-amd64:3.0 "/pause" About a minute ago Up About a minute k8s_POD_monitoring-grafana-76f5b489d5-cbkgs_kube-system_9df613c2-813a-11e8-beaa-0277d64a57f7_0 a79fb6dfdfe7 rancher/pause-amd64:3.0 "/pause" About a minute ago Up About a minute k8s_POD_kube-dns-75c8cb4ccb-4p2j6_kube-system_9a216ee8-813a-11e8-beaa-0277d64a57f7_0 c4311516e9e2 rancher/pause-amd64:3.0 "/pause" About a minute ago Up About a minute k8s_POD_kubernetes-dashboard-6f4c8b9cd5-cfcks_kube-system_9545a372-813a-11e8-beaa-0277d64a57f7_0 d2fdb204a816 rancher/etc-host-updater:v0.0.3 "/rancher-entrypoi..." 2 minutes ago Up 2 minutes r-kubernetes-kubernetes-kube-hostname-updater-1-2f50b01d 6cfe2174f2ca rancher/k8s:v1.10.3-rancher1-1 "/.r/r /usr/bin/en..." 2 minutes ago Up 2 minutes r-kubernetes-addon-starter-1-086f2eb4 37d96100ebda rancher/k8s:v1.10.3-rancher1-1 "/usr/bin/entry.sh..." 2 minutes ago Up 2 minutes r-kubernetes-kubelet-1-6129f445 e631f4acb106 rancher/k8s:v1.10.3-rancher1-1 "/.r/r /usr/bin/en..." 2 minutes ago Up 2 minutes r-kubernetes-scheduler-1-f84e883d 2514ad4deed3 rancher/k8s:v1.10.3-rancher1-1 "/.r/r /usr/bin/en..." 2 minutes ago Up 2 minutes r-kubernetes-controller-manager-1-bd6034b5 91a85568422e rancher/k8s:v1.10.3-rancher1-1 "/.r/r /usr/bin/en..." 2 minutes ago Up 2 minutes r-kubernetes-kubernetes-1-ef08f84b 5d891477f408 rancher/k8s:v1.10.3-rancher1-1 "/usr/bin/entry.sh..." 2 minutes ago Up 2 minutes r-kubernetes-proxy-1-a2ab9a7f 825482c49203 rancher/kubernetes-agent:v0.6.7 "/.r/r /usr/bin/en..." 3 minutes ago Up 2 minutes r-kubernetes-rancher-kubernetes-agent-1-65867253 75c106178046 rancher/kubernetes-auth:v0.0.8 "/.r/r /usr/bin/en..." 3 minutes ago Up 3 minutes r-kubernetes-rancher-kubernetes-auth-1-e362e1a5 2ec414b138d4 rancher/lb-service-rancher:v0.7.17 "/.r/r /usr/bin/en..." 3 minutes ago Up 3 minutes r-kubernetes-rancher-ingress-controller-1-d14b34e1 c3fb64580152 rancher/kubectld:v0.8.7 "/.r/r /rancher-en..." 4 minutes ago Up 4 minutes r-kubernetes-kubectld-1-0e85399a 2385d7798335 rancher/kubectld:v0.8.7 "/.r/r /rancher-en..." 4 minutes ago Up 4 minutes r-kubernetes-kubectl-shell-1-5d5431aa 8a57f064fd98 rancher/etcd:v2.3.7-13 "/.r/r /opt/ranche..." 4 minutes ago Up 4 minutes r-kubernetes-etcd-1-bbb53a30 e70fc5f41cbc rancher/dns:v0.17.3 "/rancher-entrypoi..." 4 minutes ago Up 4 minutes r-network-services-metadata-dns-1-e7079097
参考:
https://rancher.com/docs/rancher/v1.6/zh/installing-rancher/installing-server/#single-container
https://www.kubernetes.org.cn/2955.html
http://blog.51cto.com/john88wang/1946343
https://blog.csdn.net/csdn_duomaomao/article/details/76216046