- 浏览: 2542387 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
Rancher and k8s 2019(3)Clean Installation on CentOS7
Set Up 3 machines
192.168.56.110 rancher-home
192.168.56.111 rancher-worker1
192.168.56.112 rancher-worker2
Set Up rancher-home
The network config
Go to the network setting directory
> cd /etc/sysconfig/network-scripts/
Open the configuration file, change the last line as follow:
> sudo vi ifcfg-enp0s3
ONBOOT=yes
Enable the second network adapter on VirtualBox, copy and set the configuration file for the second network
> sudo cp ifcfg-enp0s3 ifcfg-enp0s8
> cat ifcfg-enp0s8
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
IPADDR=192.168.56.110
NETMASK=255.255.255.0
DEFROUTE=yes
Update the latest software
> sudo yum update
Disable firewall
> sudo systemctl stop firewalld.service
> sudo systemctl disable firewalld.service
Install Docker
> sudo yum install -y yum-utils device-mapper-persistent-data lvm2
> sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Then the install command will work
> sudo yum install docker-ce
> sudo usermod -aG docker $(whoami)
> sudo systemctl enable docker.service
> sudo systemctl start docker.service
Start the Rancker from Docker Image
> mkdir -p ~/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 Rancher on the first server
> make run PORT=80 SSL_PORT=443
Visit the URL
https://192.168.56.110/g/clusters
It will ask us to update the password. Then we can create a customer cluster via k8s.
For the home machine, do not use it as 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://192.168.56.110 --token 5x6452wfj86kpmxkzwxhjt7mpsbx5hxx7p66jqnpvdqk469mrxh4v7 --ca-checksum 326354803f20bff6574e64d735e854fe73e8d7fd5e9ff6a13d8252fbf5deeefa --node-name rancher-home --address 192.168.56.110 --internal-address 192.168.56.110 --etcd --controlplane
Set Up rancher-worker1
The network config
Go to the network setting directory
> cd /etc/sysconfig/network-scripts/
Open the configuration file, change the last line as follow:
> sudo vi ifcfg-enp0s3
ONBOOT=yes
Enable the second network adapter on VirtualBox, copy and set the configuration file for the second network
> sudo cp ifcfg-enp0s3 ifcfg-enp0s8
> cat ifcfg-enp0s8
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
IPADDR=192.168.56.111
NETMASK=255.255.255.0
DEFROUTE=yes
Update the latest software
> sudo yum update
Disable firewall
> sudo systemctl stop firewalld.service
> sudo systemctl disable firewalld.service
Install Docker
> sudo yum install -y yum-utils device-mapper-persistent-data lvm2
> sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Then the install command will work
> sudo yum install docker-ce
> sudo usermod -aG docker $(whoami)
> sudo systemctl enable docker.service
> sudo systemctl start docker.service
On the rancher-worker1
> 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://192.168.56.110 --token 5x6452wfj86kpmxkzwxhjt7mpsbx5hxx7p66jqnpvdqk469mrxh4v7 --ca-checksum 326354803f20bff6574e64d735e854fe73e8d7fd5e9ff6a13d8252fbf5deeefa --node-name rancher-worker1 --address 192.168.56.111 --internal-address 192.168.56.111 --worker
If I need, here is the command to kill all the containers at one
> docker kill $(docker ps -q)
Remove all the unused containers and images
> docker system prune
After I start the cluster, I can add a nginx web server there
Visit the worker page, it works pretty well.
http://rancher-worker1:31489/
After everything is working fine, we can do the similar step to set up rancher-worker2 to join the cluster as worker.
Set Up rancher-worker2
The network config
Go to the network setting directory
> cd /etc/sysconfig/network-scripts/
Open the configuration file, change the last line as follow:
> sudo vi ifcfg-enp0s3
ONBOOT=yes
Enable the second network adapter on VirtualBox, copy and set the configuration file for the second network
> sudo cp ifcfg-enp0s3 ifcfg-enp0s8
> cat ifcfg-enp0s8
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
IPADDR=192.168.56.111
NETMASK=255.255.255.0
DEFROUTE=yes
Update the latest software
> sudo yum update
Disable firewall
> sudo systemctl stop firewalld.service
> sudo systemctl disable firewalld.service
Install Docker
> sudo yum install -y yum-utils device-mapper-persistent-data lvm2
> sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Then the install command will work
> sudo yum install docker-ce
> sudo usermod -aG docker $(whoami)
> sudo systemctl enable docker.service
> sudo systemctl start docker.service
On the rancher-worker1
> 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://192.168.56.110 --token 5x6452wfj86kpmxkzwxhjt7mpsbx5hxx7p66jqnpvdqk469mrxh4v7 --ca-checksum 326354803f20bff6574e64d735e854fe73e8d7fd5e9ff6a13d8252fbf5deeefa --node-name rancher-worker2 --address 192.168.56.112 --internal-address 192.168.56.112 --worker
References:
https://gist.github.com/evanscottgray/8571828
Set Up 3 machines
192.168.56.110 rancher-home
192.168.56.111 rancher-worker1
192.168.56.112 rancher-worker2
Set Up rancher-home
The network config
Go to the network setting directory
> cd /etc/sysconfig/network-scripts/
Open the configuration file, change the last line as follow:
> sudo vi ifcfg-enp0s3
ONBOOT=yes
Enable the second network adapter on VirtualBox, copy and set the configuration file for the second network
> sudo cp ifcfg-enp0s3 ifcfg-enp0s8
> cat ifcfg-enp0s8
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
IPADDR=192.168.56.110
NETMASK=255.255.255.0
DEFROUTE=yes
Update the latest software
> sudo yum update
Disable firewall
> sudo systemctl stop firewalld.service
> sudo systemctl disable firewalld.service
Install Docker
> sudo yum install -y yum-utils device-mapper-persistent-data lvm2
> sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Then the install command will work
> sudo yum install docker-ce
> sudo usermod -aG docker $(whoami)
> sudo systemctl enable docker.service
> sudo systemctl start docker.service
Start the Rancker from Docker Image
> mkdir -p ~/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 Rancher on the first server
> make run PORT=80 SSL_PORT=443
Visit the URL
https://192.168.56.110/g/clusters
It will ask us to update the password. Then we can create a customer cluster via k8s.
For the home machine, do not use it as 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://192.168.56.110 --token 5x6452wfj86kpmxkzwxhjt7mpsbx5hxx7p66jqnpvdqk469mrxh4v7 --ca-checksum 326354803f20bff6574e64d735e854fe73e8d7fd5e9ff6a13d8252fbf5deeefa --node-name rancher-home --address 192.168.56.110 --internal-address 192.168.56.110 --etcd --controlplane
Set Up rancher-worker1
The network config
Go to the network setting directory
> cd /etc/sysconfig/network-scripts/
Open the configuration file, change the last line as follow:
> sudo vi ifcfg-enp0s3
ONBOOT=yes
Enable the second network adapter on VirtualBox, copy and set the configuration file for the second network
> sudo cp ifcfg-enp0s3 ifcfg-enp0s8
> cat ifcfg-enp0s8
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
IPADDR=192.168.56.111
NETMASK=255.255.255.0
DEFROUTE=yes
Update the latest software
> sudo yum update
Disable firewall
> sudo systemctl stop firewalld.service
> sudo systemctl disable firewalld.service
Install Docker
> sudo yum install -y yum-utils device-mapper-persistent-data lvm2
> sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Then the install command will work
> sudo yum install docker-ce
> sudo usermod -aG docker $(whoami)
> sudo systemctl enable docker.service
> sudo systemctl start docker.service
On the rancher-worker1
> 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://192.168.56.110 --token 5x6452wfj86kpmxkzwxhjt7mpsbx5hxx7p66jqnpvdqk469mrxh4v7 --ca-checksum 326354803f20bff6574e64d735e854fe73e8d7fd5e9ff6a13d8252fbf5deeefa --node-name rancher-worker1 --address 192.168.56.111 --internal-address 192.168.56.111 --worker
If I need, here is the command to kill all the containers at one
> docker kill $(docker ps -q)
Remove all the unused containers and images
> docker system prune
After I start the cluster, I can add a nginx web server there
Visit the worker page, it works pretty well.
http://rancher-worker1:31489/
After everything is working fine, we can do the similar step to set up rancher-worker2 to join the cluster as worker.
Set Up rancher-worker2
The network config
Go to the network setting directory
> cd /etc/sysconfig/network-scripts/
Open the configuration file, change the last line as follow:
> sudo vi ifcfg-enp0s3
ONBOOT=yes
Enable the second network adapter on VirtualBox, copy and set the configuration file for the second network
> sudo cp ifcfg-enp0s3 ifcfg-enp0s8
> cat ifcfg-enp0s8
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
IPADDR=192.168.56.111
NETMASK=255.255.255.0
DEFROUTE=yes
Update the latest software
> sudo yum update
Disable firewall
> sudo systemctl stop firewalld.service
> sudo systemctl disable firewalld.service
Install Docker
> sudo yum install -y yum-utils device-mapper-persistent-data lvm2
> sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Then the install command will work
> sudo yum install docker-ce
> sudo usermod -aG docker $(whoami)
> sudo systemctl enable docker.service
> sudo systemctl start docker.service
On the rancher-worker1
> 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://192.168.56.110 --token 5x6452wfj86kpmxkzwxhjt7mpsbx5hxx7p66jqnpvdqk469mrxh4v7 --ca-checksum 326354803f20bff6574e64d735e854fe73e8d7fd5e9ff6a13d8252fbf5deeefa --node-name rancher-worker2 --address 192.168.56.112 --internal-address 192.168.56.112 --worker
References:
https://gist.github.com/evanscottgray/8571828
发表评论
-
Update Site will come soon
2021-06-02 04:10 1672I am still keep notes my tech n ... -
Stop Update Here
2020-04-28 09:00 310I will stop update here, and mo ... -
NodeJS12 and Zlib
2020-04-01 07:44 468NodeJS12 and Zlib It works as ... -
Docker Swarm 2020(2)Docker Swarm and Portainer
2020-03-31 23:18 362Docker Swarm 2020(2)Docker Swar ... -
Docker Swarm 2020(1)Simply Install and Use Swarm
2020-03-31 07:58 364Docker Swarm 2020(1)Simply Inst ... -
Traefik 2020(1)Introduction and Installation
2020-03-29 13:52 330Traefik 2020(1)Introduction and ... -
Portainer 2020(4)Deploy Nginx and Others
2020-03-20 12:06 424Portainer 2020(4)Deploy Nginx a ... -
Private Registry 2020(1)No auth in registry Nginx AUTH for UI
2020-03-18 00:56 428Private Registry 2020(1)No auth ... -
Docker Compose 2020(1)Installation and Basic
2020-03-15 08:10 366Docker Compose 2020(1)Installat ... -
VPN Server 2020(2)Docker on CentOS in Ubuntu
2020-03-02 08:04 445VPN Server 2020(2)Docker on Cen ... -
Buffer in NodeJS 12 and NodeJS 8
2020-02-25 06:43 377Buffer in NodeJS 12 and NodeJS ... -
NodeJS ENV Similar to JENV and PyENV
2020-02-25 05:14 468NodeJS ENV Similar to JENV and ... -
Prometheus HA 2020(3)AlertManager Cluster
2020-02-24 01:47 414Prometheus HA 2020(3)AlertManag ... -
Serverless with NodeJS and TencentCloud 2020(5)CRON and Settings
2020-02-24 01:46 331Serverless with NodeJS and Tenc ... -
GraphQL 2019(3)Connect to MySQL
2020-02-24 01:48 243GraphQL 2019(3)Connect to MySQL ... -
GraphQL 2019(2)GraphQL and Deploy to Tencent Cloud
2020-02-24 01:48 445GraphQL 2019(2)GraphQL and Depl ... -
GraphQL 2019(1)Apollo Basic
2020-02-19 01:36 321GraphQL 2019(1)Apollo Basic Cl ... -
Serverless with NodeJS and TencentCloud 2020(4)Multiple Handlers and Running wit
2020-02-19 01:19 307Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(3)Build Tree and Traverse Tree
2020-02-19 01:19 310Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(2)Trigger SCF in SCF
2020-02-19 01:18 286Serverless with NodeJS and Tenc ...
相关推荐
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_node3,IP地址:192.168.1.18,操作系统:Ubuntu 16.04/内核4.4.0,角色:K8s-node ##### 操作步骤 1. **运行Rancher Server**: ```shell docker run -d --restart always --name ...
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教程
K8S Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.2", GitCommit:"52c56ce7a8272c798dbc29846288d7cd9fbae032", GitTreeState:"clean", BuildDate:"2020-04-16T11:56:40Z", GoVersion:...
使用RKE构建企业生产Kubernetes集群 内容包含: 1.集群主机准备 2.daocker部署 3.docker compose安装 4.添加rancher用户 5.生成ssh证书用户部署集群 6.rke工具下载 7.初始化rke配置文件 ....
总结来说,容器持久化存储是解决容器化应用数据持久化的关键技术,Kubernetes作为云原生的操作系统,提供了强大的容器管理和编排能力,而Rancher则为企业级K8s部署提供了便利的管理平台。这三者共同推动了容器云技术...
自动安装Docker、rancher、k8s、mysql、redis、haproxy、mongodb、nginx、Node.js , mosquitto (MQTT
【Dapr学习(2)之Rancher2.63(k8s&k3s)环境安装Dapr】 在本文中,我们将深入探讨如何在Kubernetes(k8s)和k3s环境中,利用Rancher2.6.3管理工具安装Dapr。Dapr(Distributed Application Runtime)是一个...
"二进制高可用k8s集群一键部署脚本"是为简化k8s集群搭建过程而设计的工具,它基于阿良的二进制部署文档,旨在帮助开发者和学习者快速创建一个稳定的高可用k8s集群。 首先,了解二进制部署意味着不依赖于预打包的...
jenkins调用shell触发rancher命令通过yml方式部署微服务镜像
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-...
3. 所有节点关闭 CentOS 7 的防火墙 关闭防火墙,可以使用以下命令: `systemctl stop firewalld` `systemctl disable firewalld` 并启用 iptables: `yum install iptables-services -y` `systemctl restart ...
在本篇内容中,我们将详细讨论如何使用Rancher 2.2版本部署Kubernetes(k8s)集群,以及涉及的关键组件和操作步骤。Rancher是一个流行的开源平台,用于管理和部署容器化应用程序,而Kubernetes则是一个自动化容器...
k8s部署rancher,rancher证书文件
k8s-dns-sidecar-amd64-1.14.8镜像,镜像使用方法: docker load -i k8s-dns-sidecar-amd64-1.14.8.tar.gz
包含NodePort,HostPort,ClusterIp几种方式自动化部署脚本。