Home | 简体中文 | 繁体中文 | 杂文 | 知乎专栏 | 51CTO学院 | CSDN程序员研修院 | Github | OSChina 博客 | 腾讯云社区 | 阿里云栖社区 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏多维度架构

第 3 章 容器图形化管理界面

目录

3.1. Portainer
3.1.1. 安装
3.1.2. 配置 Portainer
3.1.3. 添加代理出错
3.2. Rancher - Multi-Cluster Kubernetes Management
3.2.1. 安装 Rancher
3.2.1.1. Rancher Server
3.2.1.1.1. 防火墙配置
3.2.1.1.2. Web UI
3.2.1.1.3. SSL 证书
3.2.1.1.4. 进入容器
3.2.1.2. Rancher Kubernetes Engine (RKE)
3.2.1.2.1. 安装 RKE
3.2.1.2.2. 配置 RKE
3.2.1.2.3. 启动 RKE
3.2.1.3. Rancher CLI
3.2.1.3.1. 二进制安装
3.2.1.3.2. Mac 安装
3.2.1.4. rancher-compose
3.2.1.4.1. v0.12.5
3.2.2. 快速入门
3.2.2.1. API
3.2.3. Rancher Compose
3.2.3.1. Rancher Compose 命令
3.2.3.2. 操作演示
3.2.4. Rancher CLI
3.2.4.1. 登陆 Rancher
3.2.4.2. 查看集群
3.2.4.3. 查看节点
3.2.4.4. catalog
3.2.4.5. 查看设置
3.2.4.6. rancher kubectl
3.2.5. Rancher Demo
3.2.5.1. Rancher 部署 Nginx
3.2.6. FAQ
3.2.6.1. 调试 Rancher 查看日志
3.2.6.2. [network] Host [rancher.netkiller.cn] is not able to connect to the following ports: [rancher.netkiller.cn:2379]. Please check network policies and firewall rules
3.3. Helm - The package manager for Kubernetes
3.3.1. 安装 Helm
3.3.1.1. Ubuntu
3.3.1.2. Mac
3.3.2. 快速开始
3.3.3. Helm 命令
3.3.3.1. 初始化 Helm
3.3.3.2. 查看仓库列表
3.3.3.3. 搜索
3.3.3.4. 查看包信息
3.3.3.5. 安装
3.3.3.6. 列表
3.3.3.7. 删除
3.3.3.8. 升级
3.3.3.9. 回滚
3.3.3.10. 查看状态
3.3.4. elastic
3.3.5. Helm The package manager for Kubernetes
3.3.6. Helm Faq

3.1. Portainer

Portainer 是一个轻量级的 Docker 管理界面,官方提供了 Demo 演示地址

3.1.1. 安装

Server 服务器安装

			
docker volume create portainer_data
docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
			
		

Agent 代理安装

			
docker run -d -p 9001:9001 --name portainer_agent --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/volumes:/var/lib/docker/volumes portainer/agent			
			
		

使用 docker-compose 安装

			
version: '3.9'

services:
  portainer:
    image: portainer/portainer-ce
    container_name: prtainer
    restart: always
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - portainter:/data
    ports:
      - 8000:8000
      - 9000:9000

  portainer-agent:
    image: portainer/agent
    container_name: portainer-agent
    restart: always
    volumes:
        - /var/run/docker.sock:/var/run/docker.sock
        - /var/lib/docker/volumes:/var/lib/docker/volumes
    ports:
        - 9001:9001

volumes:
  portainter:    			
			
		
			
第一台管理服务器,启动管理界面:
[root@netkiller portainer]# docker-compose up -d portainer

第二台开发环境服务器,启动代理:
[root@development portainer]# docker-compose up -d portainer-agent

第三台测试环境服务器,启动代理
[root@testing portainer]# docker-compose up -d portainer-agent			
			
		

3.1.2. 配置 Portainer

设置管理员密码,创建用户

当前界面中有三个选项,分别是 Docker(本地 Docker),Kubernetes, Agent(代理)

添加本地 Docker,通过 UNIX SOCK 链接,通常是 /var/run/docker.sock

点击 Connect 按钮就可以建立链接

添加代理 Docker,左边菜单点击 Endpoints,然后点击 Add endpoint

选择 Agent

Name 给代理起个名气,Endpoint URL 输入代理的IP地址和端口号,Group 是分组(可不选),最后点击 Add endpoint 按钮。

完成代理的添加

回到 Home

3.1.3. 添加代理出错

portainer 错误日志

			
portainer          | 2021/08/04 07:24:14 http error: Unable to initiate communications with endpoint (err=agent already paired with another Portainer instance) (code=500)
portainer          | 2021/08/04 07:25:49 http error: Unable to initiate communications with endpoint (err=agent already paired with another Portainer instance) (code=500)			
			
		

agent 日志

			
portainer-agent    | 2021/08/04 07:25:49 http error: Invalid request signature (err=Unauthorized) (code=403)
portainer-agent    | 2021/08/04 07:25:49 http error: Invalid request signature (err=Unauthorized) (code=403)			
			
		

问题出在,重装了 portainer 先前的 agent 已经与之前的 portainer 建立链接。

解决方法,重装 agent 记得要删除卷。

			
[root@testing portainer]# docker-compose stop portainer-agent
Stopping portainer-agent ... done

[root@testing portainer]# docker-compose rm -a  portainer-agent
WARNING: --all flag is obsolete. This is now the default behavior of `docker-compose rm`
Going to remove portainer-agent
Are you sure? [yN] y
Removing portainer-agent ... done

[root@testing portainer]# docker volume ls
DRIVER    VOLUME NAME
local     portainer_portainter

[root@testing portainer]# docker volume rm portainer_portainter
portainer_portainter

[root@testing portainer]# docker-compose up -d portainer-agent
Creating volume "portainer_portainter" with default driver
Creating portainer-agent ... done

[root@testing portainer]# docker-compose ps
     Name         Command   State                    Ports                  
----------------------------------------------------------------------------
portainer-agent   ./agent   Up      0.0.0.0:9001->9001/tcp,:::9001->9001/tcp