rancher单节点离线安装_Rancher部署Spring Cloud微服务(初探)
一 、 安装Docker安装rancher依赖docker环境,k8s节点也依赖docker环境,可以自行安装,没有安装过的可以参考网上的教程。二、安装单节点rancher2.1 下载镜像包官方2.x文档DockerHubdocker pull rancher/rancher:stable2.2 环境准备需要预留的端口号:80、4432.3 运行镜像docker run -d --restart=
一 、 安装Docker
安装rancher依赖docker环境,k8s节点也依赖docker环境,可以自行安装,没有安装过的可以参考网上的教程。
二、安装单节点rancher
2.1 下载镜像包
官方2.x文档
DockerHub
docker pull rancher/rancher:stable
2.2 环境准备
- 需要预留的端口号:80、443
2.3 运行镜像
docker run -d --restart=unless-stopped -p 80:80 -p 443:443 -v :/var/lib/rancher/ -v /root/var/log/auditlog:/var/log/auditlog -e AUDIT_LEVEL=3 ancher/rancher:stable
2.4 查看页面

初始页面要设置密码
##三、部署单节点k8s
3.1 添加集群


在node节点运行
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.5 --server https://192.168.25.142 --token xnw2bc27vpcqtthpjrk8cmjhxf4h25dgsldrd2jhvz624hx4cvj78r --ca-checksum 942c504c79bfcb14257a188bbb9d84059a752bd14b362a3194bef1872c097cf4 --node-name k8s-node1 --etcd --controlplane --worker

四、 部署spring cloud微服务
4.1 新建项目(命名空间)



4.2 新建项目命名空间
相当docker的network桥接网络,一个命名空间内的服务可以通过服务名称来互相访问。
例如:http://taco-config-server配置中心服务的访问名称
不同的命名空间内的服务也可以配置hostname访问,在工作负载 -》服务发现 -》添加DNS记录 -》服务别名
后面会给出设置例子




4.3 部署服务


这里需要注意服务的部署时需要顺序的:
mysql、redis、rabbitmq
config-server
eureka(依赖配置中心拉取配置文件)
service(网关、授权认证中心、IAM、BIZ服务等等)
监控...
部署taco-config-server


设置gitlab的域名映射

启动服务

查看日志



访问端口,需要先关闭防火墙
#关闭防火墙systemctl stop firewalld.service#禁止firewall开机启动systemctl disable firewalld.service #查看防火墙状态firewall-cmd --state

查看配置文件

部署eureka集群,计划是部署两个eureka服务
eureka01服务

eureka02服务

查看eureka服务状态

auth-server和iam-server基本是一样的
4.4不同的命名空间内的服务配置hostname访问
在工作负载 -》服务发现 -》添加DNS记录 -》服务别名
新建命名空间other-proj


设置hostname映射



这样就可以other-proj命名空间的服务就可以通过eureka01访问到eureka01命名空间里的eureka01服务了
来源:https://my.oschina.net/teddyIH/blog/3098240
更多推荐
所有评论(0)