Centos7安装Rancher2.x集群管理环境
参考文档:https://www.cnrancher.com/docs/rancher/v2.x/cn/installation/basic-environment-configuration/
Rancher是一套容器管理平台,它可以帮助组织在生产环境中轻松快捷的部署和管理容器。 Rancher可以轻松地管理各种环境的Kubernetes,满足IT需求并为DevOps团队提供支持。
基于Kubernetes基础上重新设计Rancher2.0版本。
因为K8S的规定,主机名只支持包含 - 和 .(中横线和点)两种特殊符号,并且主机名不能出现重复。
Docker环境
# rancher:stable最新稳定版
docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher:stable
安装完浏览器进入<服务器ip>:80,会有UI界面,就可以在UI界面操作了。
需要配置自己的证书的可以进设置里把自签名的证书换成自己的权威证书。
需要外部用nginx跳转到rancher的,可以把自签名证书删掉,传递header为X-Forwarded-Proto https
可不跳转到https。原文教程:https://www.cnrancher.com/docs/rancher/v2.x/cn/installation/server-installation/single-node-install-external-lb/
nginx如下配置:
upstream rancher {
server rancher-server:80;
}
map $http_upgrade $connection_upgrade {
default Upgrade;
'' close;
}
server {
listen 443 ssl http2;
server_name rancher.yourdomain.com;
ssl_certificate /etc/your_certificate_directory/fullchain.pem;
ssl_certificate_key /etc/your_certificate_directory/privkey.pem;
location / {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://rancher;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
# This allows the ability for the execute shell window to remain open for up to 15 minutes. Without this parameter, the default is 1 minute and will automatically close.
proxy_read_timeout 900s;
}
}
server {
listen 80;
server_name rancher.yourdomain.com;
return 301 https://$server_name$request_uri;
}
https://www.cnrancher.com/docs/rancher/v2.x/cn/overview/quick-start-guide/