`
sillycat
  • 浏览: 2542467 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Rancher and k8s 2019(1)Introduction and First Sample

 
阅读更多
Rancher and k8s 2019(1)Introduction and First Sample

Try on my CentOS
Installed Docker on the machine
> docker --version
Docker version 19.03.2, build 6a30dfc

Start the Rancker from Docker Image
> mkdir ~/tool/rancher-docker
> sudo ln -s /home/carl/tool/rancher-docker /opt/rancher-docker
> sudo ln -s /opt/rancher-docker /opt/rancher

Go to the working directory
> cd /opt/rancher
> mkdir /opt/rancher/rancher_home

Prepare a Makefile there
> cat Makefile
PORT=9090
SSL_PORT=9091
IMAGE=rancher/rancher
TAG=stable
NAME=rancher-$(PORT)
run:
docker run \
-d \
        --restart=unless-stopped \
-p $(PORT):80 \
-p $(SSL_PORT):443 \
-v $(shell pwd)/rancher_home:/var/lib/rancher/ \
--name $(NAME) \
$(IMAGE):$(TAG)
clean:
docker stop ${NAME}
docker rm ${NAME}

Start to run that
> make run

Check the running status
> docker ps
CONTAINER ID        IMAGE                    COMMAND             CREATED             STATUS              PORTS                                         NAMES
c4c932adb121        rancher/rancher:stable   "entrypoint.sh"     15 seconds ago      Up 14 seconds       0.0.0.0:9090->80/tcp, 0.0.0.0:9091->443/tcp   rancher-9090

Visit the HTTPS port, it will ask you to set up the password and etc.
https://centos-dev1:9091/

Create my Cluster
[Global] —> [Clusters] —> [Add Cluster] —> [From my Existing Nodes] my current demo testing
Cluster Name: dockerdemo

Next Button

Checkbox Worker
>sudo docker run -d --privileged --restart=unless-stopped --net=host -v /etc/kubernetes:/etc/kubernetes -v /var/run:/var/run rancher/rancher-agent:v2.2.8 --server https://centos-dev1:9091 --token fmnlt47dl5dp52ddj2hpxfqmkqd69wpm6gjlq9xnkr6bzdd26mmvd2 --ca-checksum 06c2f71d46eaea14f4a21eeb0ec59e73899b56fe5e27204c4357caa93ab0ba8e --worker

Checkbox Worker/Control Plane
>sudo docker run -d --privileged --restart=unless-stopped --net=host -v /etc/kubernetes:/etc/kubernetes -v /var/run:/var/run rancher/rancher-agent:v2.2.8 --server https://centos-dev1:9091 --token fmnlt47dl5dp52ddj2hpxfqmkqd69wpm6gjlq9xnkr6bzdd26mmvd2 --ca-checksum 06c2f71d46eaea14f4a21eeb0ec59e73899b56fe5e27204c4357caa93ab0ba8e --controlplane --worker

Checkbox ETCD/Control Plane/Worker
>sudo docker run -d --privileged --restart=unless-stopped --net=host -v /etc/kubernetes:/etc/kubernetes -v /var/run:/var/run rancher/rancher-agent:v2.2.8 --server https://centos-dev1:9091 --token fmnlt47dl5dp52ddj2hpxfqmkqd69wpm6gjlq9xnkr6bzdd26mmvd2 --ca-checksum 06c2f71d46eaea14f4a21eeb0ec59e73899b56fe5e27204c4357caa93ab0ba8e --etcd --controlplane --worker

Run this command on my centos-dev1
> sudo docker run -d --privileged --restart=unless-stopped --net=host -v /etc/kubernetes:/etc/kubernetes -v /var/run:/var/run rancher/rancher-agent:v2.2.8 --server https://centos-dev1:9091 --token fmnlt47dl5dp52ddj2hpxfqmkqd69wpm6gjlq9xnkr6bzdd26mmvd2 --ca-checksum 06c2f71d46eaea14f4a21eeb0ec59e73899b56fe5e27204c4357caa93ab0ba8e --etcd --controlplane --worker

Click on the cluster name dockerdemo, it will drive us to the cluster information page.

It shows to me the first cluster is there with only one node.

Go to cluster ‘dockerdemo’ —> [Default] —> [Workloads] —> [Deploy]
Name: nginxdemo
Docker Image: nginx:alpine
WorkloadType: 1 pod
Namespace: default

[Add Port]
80 —> TCP —> NodePort(On every node) 30000

[Launch] button

Visit page
http://centos-dev1:30000/

Stop the service and try others
> make clean

Try on my MAC
> docker --version
Docker version 19.03.2, build 6a30dfc

Do the similar thing on MAC
> make run PORT=80 SSL_PORT=443


References:
https://www.itfanr.cc/2019/08/31/lightweight-kubernetes-release-k3s-issues/
https://www.rancher.cn/rancher-k3s/
https://rancher.com/docs/rancher/v2.x/en/
https://rancher.com/docs/rancher/v2.x/en/installation/ha/

Rancher
https://tonybai.com/2016/04/14/an-introduction-about-rancher/
https://www2.cnrancher.com/rancherv2-0-quick-start-guide/
https://www.rancher.cn/docs/
https://www.rancher.cn/docs/rancher/v2.x/cn/overview/
https://www.cnblogs.com/horizonli/p/10572573.html

k8s
https://www.jianshu.com/p/6b8ee8a5010f

https://blog.csdn.net/CSDN_duomaomao/article/details/78029800
https://www.zhihu.com/question/309076492

分享到:
评论

相关推荐

    Rancher部署K8s相关镜像(1)

    K8S Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.2", GitCommit:"52c56ce7a8272c798dbc29846288d7cd9fbae032", GitTreeState:"clean", BuildDate:"2020-04-16T11:56:40Z", GoVersion:...

    rancher-k8s

    - 主机名:Rancher_K8s_node1,IP地址:192.168.1.16,操作系统:Ubuntu 16.04/内核4.4.0,角色:K8s-node - 主机名:Rancher_K8s_node2,IP地址:192.168.1.17,操作系统:Ubuntu 16.04/内核4.4.0,角色:K8s-...

    Rancher部署K8s相关镜像(3)

    K8S Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.2", GitCommit:"52c56ce7a8272c798dbc29846288d7cd9fbae032", GitTreeState:"clean", BuildDate:"2020-04-16T11:56:40Z", GoVersion:...

    Docker-Rancher-K8S教程.docx

    Docker-Rancher-K8S教程

    Rancher部署K8s相关镜像(2)

    K8S Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.2", GitCommit:"52c56ce7a8272c798dbc29846288d7cd9fbae032", GitTreeState:"clean", BuildDate:"2020-04-16T11:56:40Z", GoVersion:...

    rancher+k8s+etcd集群

    使用RKE构建企业生产Kubernetes集群 内容包含: 1.集群主机准备 2.daocker部署 3.docker compose安装 4.添加rancher用户 5.生成ssh证书用户部署集群 6.rke工具下载 7.初始化rke配置文件 ....

    Rancher、k8s和容器持久化存储

    总结来说,容器持久化存储是解决容器化应用数据持久化的关键技术,Kubernetes作为云原生的操作系统,提供了强大的容器管理和编排能力,而Rancher则为企业级K8s部署提供了便利的管理平台。这三者共同推动了容器云技术...

    自动安装Docker、rancher、k8s、mysql、redis、haproxy、mongodb、nginx、N

    自动安装Docker、rancher、k8s、mysql、redis、haproxy、mongodb、nginx、Node.js , mosquitto (MQTT

    rancher shell deploy K8S docker

    jenkins调用shell触发rancher命令通过yml方式部署微服务镜像

    rancher2.2部署k8s实操1

    在本篇内容中,我们将详细讨论如何使用Rancher 2.2版本部署Kubernetes(k8s)集群,以及涉及的关键组件和操作步骤。Rancher是一个流行的开源平台,用于管理和部署容器化应用程序,而Kubernetes则是一个自动化容器...

    k8s平台rancher V2.4.5 docker镜像包

    k8s平台rancher V2.4.5 docker镜像包包含:rancher/prom-node-exporter v0.18.1、rancher/mirrored-flannelcni-flannel v0.16.1、registry.aliyuncs.com/google_containers/kube-proxy v1.17.0、rancher/mirrored-...

    Dapr学习(2)之Rancher2.63(k8s&k3s)环境安装Dapr.doc

    【Dapr学习(2)之Rancher2.63(k8s&k3s)环境安装Dapr】 在本文中,我们将深入探讨如何在Kubernetes(k8s)和k3s环境中,利用Rancher2.6.3管理工具安装Dapr。Dapr(Distributed Application Runtime)是一个...

    二进制高可用k8s集群一键部署脚本

    1. **环境准备**:确保所有节点的操作系统、Docker和网络设置符合k8s的要求。 2. **二进制文件获取**:从官方仓库下载k8s的最新或特定版本二进制文件。 3. **配置文件编辑**:为每个组件创建配置文件,设定如证书、...

    k8s部署rancher,rancher证书文件

    k8s部署rancher,rancher证书文件

    k8s-dns-sidecar-amd64

    k8s-dns-sidecar-amd64-1.14.8镜像,镜像使用方法: docker load -i k8s-dns-sidecar-amd64-1.14.8.tar.gz

    kubernetes介单节点rancher安装部署手册

    kubernetes单节点Rancher安装部署手册 kubernetes是一个开源的容器编排系统,可以自动部署、扩展和管理容器化应用程序。Rancher是一个kubernetes-as-a-service解决方案,提供了图形化界面来部署和管理kubernetes...

    k8s集群pod经常重启问题排查总结.doc

    k8s集群pod经常重启问题排查总结

Global site tag (gtag.js) - Google Analytics