码迷,mamicode.com
首页 > 其他好文 > 详细

Rancher 2.0 简单使用 重要部分截取

时间:2018-05-16 13:04:40      阅读:2111      评论:0      收藏:0      [点我收藏+]

标签:2.x   jad   oda   stat   local   usr   discovery   entry   1.2   

学习地址 : https://rancher.com/docs/rancher/v2.x/en/quick-start-guide/

 

 

Install Rancher

      docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher

Create The Cluster

      技术分享图片

      技术分享图片

      第 9和10步会有坑:

        粘贴复制的如果是这样的

docker run -d --privileged --restart=unless-stopped --net=host -v /etc/kubernetes:/etc/kubernetes -v /var/run:/var/run rancher/rancher-agent:v2.0.0 --server https://111.231.54.107 --token 6vjzssptlf2scfnl4vtfn58xhc6p62s6tbrfv9ct8j2vqt2fm4drpz --ca-checksum f4d5d930d3b0265e5cac3ad8380dafe5513179e53f55d5950c1eef2559eaa91d --etcd --controlplane --worker

        那添加多个节点会出问题 由于 下图显示的 requestedHostname 很可能会冲突 默认貌似是 node ip地址的前三位

          解决方法:必须添加一个参数 直接接在 docker run -d 后面 --hostname=xxx 添加在最后面没用

          下图黄色的这个容器在 node 成功添加到集群后会消失

[root@192 ~]# docker ps -a
CONTAINER ID        IMAGE                                COMMAND                  CREATED             STATUS              PORTS               NAMES
bae9df76e3f8        rancher/hyperkube:v1.10.1-rancher2   "/opt/rke/entrypoint鈥   2 minutes ago       Up 16 seconds                           kube-apiserver
e40b8b2133c7        rancher/rke-tools:v0.1.4             "/bin/bash"              2 minutes ago       Created                                 service-sidekick
c51936991830        rancher/coreos-etcd:v3.1.12          "/usr/local/bin/etcd鈥   2 minutes ago       Up 2 minutes                            etcd
7abc88787b51        rancher/rancher-agent:v2.0.0         "run.sh -- share-roo鈥   2 minutes ago       Up 2 minutes                            share-mnt
84ac3f76f90d        rancher/rancher-agent:v2.0.0         "run.sh --server htt鈥   2 minutes ago       Up 2 minutes                            xenodochial_tesla
[root@192 ~]# docker logs 84ac3f76f90d
-----BEGIN CERTIFICATE-----
MIIC7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g="Option controlPlane=true"
time="2018-05-16T02:57:01Z" level=info msg="Option worker=true"
time="2018-05-16T02:57:01Z" level=info msg="Option requestedHostname=192"
time="2018-05-16T02:57:01Z" level=info msg="Option customConfig=map[address:192.168.0.36 internalAddress: roles:[etcd worker controlplane]]"
time="2018-05-16T02:57:01Z" level=info msg="Option etcd=true"
time="2018-05-16T02:57:01Z" level=info msg="Connecting to wss://111.231.54.107/v3/connect/register with token 6vjzssptlf2scfnl4vtfn58xhc6p62s6tbrfv9ct8j2vqt2fm4drpz"
time="2018-05-16T02:57:01Z" level=info msg="Connecting to proxy" url="wss://111.231.54.107/v3/connect/register"
time="2018-05-16T02:57:02Z" level=info msg="Starting plan monitor"
[root@192 ~]# 

 Deploy a Workload

      技术分享图片

      技术分享图片

      技术分享图片

      技术分享图片

 

      成功后

 

      技术分享图片

      Service Discovery 里面会有自动添加的 services 删除 Workloads 里面的 nginx 会自动删除相应的services 而 删除 自动生成的两个services 没用 还会再次自动添加

      技术分享图片

访问

      总共是有两个节点的

      技术分享图片

      访问NGINX的方式

        192.168.0.35:31908或192.168.0.36:31908  会自动在10个nginx中负载均衡

        最好的测试镜像其实是这个   docker pull lpregistry2018/regularly-used:kubernetes-bootcamp__v1

Rancher 2.0 简单使用 重要部分截取

标签:2.x   jad   oda   stat   local   usr   discovery   entry   1.2   

原文地址:https://www.cnblogs.com/LiuPan2016/p/9044749.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!