构建Docker平台【第三篇】安装 kubernetes 组件
第一步:准备
1. 安装包:
kubeadm-1.6.0-0.alpha.0.2074.a092d8e0f95f52.x86_64.rpm
kubernetes-cni-0.3.0.1-0.07a8a2.x86_64.rpm
kubelet-1.5.1-0.x86_64.rpm
kubectl-1.5.1-0.x86_64.rpm
etcd-v2.2.1-linux-amd64.tar.gz
2. 上传
在三台主机分别上传以上安装包。


第二步:安装 k8s
# yum localinstall *.rpm -y
返回信息:


第三步:安装 tmux
# yum install tmux
返回信息:

第四步:安装配置 etcd
1. 删除默认的 k8s 配置文件
# rm -rf /etc/kubernetes/
2. 解压 etcd 压缩包
# tar zxvf etcd-v2.2.1-linux-amd64.tar.gz# mv etcd-v2.2.1-linux-amd64 etcd# cd etcd
3. 执行 tmux 进入后台,执行 etcd 配置脚本
1)在 192.168.6.128 执行
./etcd --name infra0 --initial-advertise-peer-urls http://192.168.6.128:2380 \
--listen-peer-urls http://192.168.6.128:2380 \
--listen-client-urls http://192.168.6.128:2379,http://127.0.0.1:2379 \
--advertise-client-urls http://192.168.6.128:2379 \
--initial-cluster-token etcd-cluster- \
--initial-cluster infra0=http://192.168.6.128:2380,infra1=http://192.168.6.129:2380,infra2=http://192.168.6.130:2380 \
--initial-cluster-state new
返回信息:
-- ::
-- ::34.058350 I | etcdmain: Git SHA: 75f8282
-- ::34.058358 I | etcdmain: Go Version: go1.5.1
-- ::34.058364 I | etcdmain: Go OS/Arch: linux/amd64
-- ::, total number of available CPUs
-- ::34.058385 W | etcdmain: no data-dir provided, using default data-dir ./infra0.etcd
-- ::34.058499 I | etcdmain: listening for peers on http://192.168.6.128:2380
-- ::34.058545 I | etcdmain: listening for client requests on http://127.0.0.1:2379
-- ::34.058575 I | etcdmain: listening for client requests on http://192.168.6.128:2379
-- ::34.060783 I | etcdserver: name = infra0
-- ::34.060805 I | etcdserver: data dir = infra0.etcd
-- ::34.060813 I | etcdserver: member dir = infra0.etcd/member
-- ::34.060820 I | etcdserver: heartbeat = 100ms
-- ::34.060826 I | etcdserver: election = 1000ms
-- ::
-- ::34.060851 I | etcdserver: advertise client URLs = http://192.168.6.128:2379
-- ::34.060862 I | etcdserver: initial advertise peer URLs = http://192.168.6.128:2380
-- ::34.060882 I | etcdserver: initial cluster = infra0=http://192.168.6.128:2380,infra1=http://192.168.6.129:2380,infra2=http://192.168.6.130:2380
-- ::34.102470 I | etcdserver: starting member 205e265f32ab88c4 in cluster 24d40765d97551b1
-- ::
-- ::, commit: , applied: , lastindex: , lastterm: ]
-- ::
-- ::, cluster version: to_be_decided]
-- ::34.162442 E | etcdmain: failed to notify systemd for readiness: No socket
-- ::34.162485 E | etcdmain: forgot to set Type=notify in systemd service file?
-- ::34.168847 N | etcdserver: added local member 205e265f32ab88c4 [http://192.168.6.128:2380] to cluster 24d40765d97551b1
-- ::34.169066 N | etcdserver: added member 277ba44edc63d7cd [http://192.168.6.130:2380] to cluster 24d40765d97551b1
-- ::34.169745 N | etcdserver: added member c1d267ff57ac5bcc [http://192.168.6.129:2380] to cluster 24d40765d97551b1
-- ::: getsockopt: connection refused)
-- ::: getsockopt: connection refused)
-- ::: getsockopt: connection refused)
-- ::: getsockopt: connection refused)
-- ::
-- ::
-- ::
-- ::, index: ] sent vote request to 277ba44edc63d7cd at term
-- ::, index: ] sent vote request to c1d267ff57ac5bcc at term
-- ::: getsockopt: connection refused)
-- ::: getsockopt: connection refused)
-- ::
-- ::
-- ::
-- ::, index: ] sent vote request to 277ba44edc63d7cd at term
-- ::, index: ] sent vote request to c1d267ff57ac5bcc at term
-- ::
-- ::
-- ::
-- ::, index: ] sent vote request to c1d267ff57ac5bcc at term
-- ::, index: ] sent vote request to 277ba44edc63d7cd at term
-- ::
-- ::
-- ::
-- ::, index: ] sent vote request to 277ba44edc63d7cd at term
-- ::, index: ] sent vote request to c1d267ff57ac5bcc at term
-- ::
-- ::
-- ::
-- ::, index: ] sent vote request to 277ba44edc63d7cd at term
-- ::, index: ] sent vote request to c1d267ff57ac5bcc at term
-- ::41.168876 E | etcdserver: publish error: etcdserver: request timed out
-- ::
-- ::
-- ::
-- ::, index: ] sent vote request to 277ba44edc63d7cd at term
-- ::, index: ] sent vote request to c1d267ff57ac5bcc at term
-- ::
-- ::
-- ::
-- ::, index: ] sent vote request to 277ba44edc63d7cd at term
-- ::, index: ] sent vote request to c1d267ff57ac5bcc at term
-- ::
-- ::
-- ::
-- ::, index: ] sent vote request to 277ba44edc63d7cd at term
-- ::, index: ] sent vote request to c1d267ff57ac5bcc at term
-- ::
-- ::
-- ::
-- ::, index: ] sent vote request to c1d267ff57ac5bcc at term
-- ::, index: ] sent vote request to 277ba44edc63d7cd at term
-- ::
-- ::
-- ::
-- ::, index: ] sent vote request to 277ba44edc63d7cd at term
-- ::, index: ] sent vote request to c1d267ff57ac5bcc at term
-- ::47.855884 I | rafthttp: the connection with c1d267ff57ac5bcc became active
-- ::] ignored a MsgVote message with lower term ]
-- ::
-- ::
-- ::
-- ::, index: ] sent vote request to 277ba44edc63d7cd at term
-- ::, index: ] sent vote request to c1d267ff57ac5bcc at term
-- ::
-- ::] has received votes and vote rejections
-- ::
-- ::
-- ::48.164621 W | etcdserver: failed to reach the peerURL(http://192.168.6.130:2380) of member 277ba44edc63d7cd (Get http://192.168.6.130:2380/version: dial tcp 192.168.6.130:2380: getsockopt: connection refused)
-- ::48.164660 W | etcdserver: cannot get the version of member 277ba44edc63d7cd (Get http://192.168.6.130:2380/version: dial tcp 192.168.6.130:2380: getsockopt: connection refused)
-- ::48.167418 I | etcdserver: setting up the initial cluster version to 2.1
-- ::48.169673 E | etcdserver: publish error: etcdserver: request timed out, possibly due to connection lost
-- ::48.173202 N | etcdserver: set the initial cluster version to 2.1
-- ::48.176115 I | etcdserver: published {Name:infra0 ClientURLs:[http://192.168.6.128:2379]} to cluster 24d40765d97551b1
-- ::53.169422 W | etcdserver: failed to reach the peerURL(http://192.168.6.130:2380) of member 277ba44edc63d7cd (Get http://192.168.6.130:2380/version: dial tcp 192.168.6.130:2380: getsockopt: connection refused)
-- ::53.169475 W | etcdserver: cannot get the version of member 277ba44edc63d7cd (Get http://192.168.6.130:2380/version: dial tcp 192.168.6.130:2380: getsockopt: connection refused)
-- ::58.177751 W | etcdserver: failed to reach the peerURL(http://192.168.6.130:2380) of member 277ba44edc63d7cd (Get http://192.168.6.130:2380/version: dial tcp 192.168.6.130:2380: getsockopt: connection refused)
-- ::58.177823 W | etcdserver: cannot get the version of member 277ba44edc63d7cd (Get http://192.168.6.130:2380/version: dial tcp 192.168.6.130:2380: getsockopt: connection refused)
-- ::01.438424 I | rafthttp: the connection with 277ba44edc63d7cd became active
-- ::03.191553 I | etcdserver: updating the cluster version from 2.1 to 2.2
-- ::03.197963 N | etcdserver: updated the cluster version from 2.1 to 2.2
2)在 192.168.6.129 上执行:
./etcd --name infra1 --initial-advertise-peer-urls http://192.168.6.129:2380 \
--listen-peer-urls http://192.168.6.129:2380 \
--listen-client-urls http://192.168.6.129:2379,http://127.0.0.1:2379 \
--advertise-client-urls http://192.168.6.129:2379 \
--initial-cluster-token etcd-cluster- \
--initial-cluster infra0=http://192.168.6.128:2380,infra1=http://192.168.6.129:2380,infra2=http://192.168.6.130:2380 \
--initial-cluster-state new
返回信息:
-- ::
-- ::47.824299 I | etcdmain: Git SHA: 75f8282
-- ::47.824318 I | etcdmain: Go Version: go1.5.1
-- ::47.824332 I | etcdmain: Go OS/Arch: linux/amd64
-- ::, total number of available CPUs
-- ::47.824376 W | etcdmain: no data-dir provided, using default data-dir ./infra1.etcd
-- ::47.824605 I | etcdmain: listening for peers on http://192.168.6.129:2380
-- ::47.824832 I | etcdmain: listening for client requests on http://127.0.0.1:2379
-- ::47.824919 I | etcdmain: listening for client requests on http://192.168.6.129:2379
-- ::47.830245 I | etcdserver: name = infra1
-- ::47.830298 I | etcdserver: data dir = infra1.etcd
-- ::47.830316 I | etcdserver: member dir = infra1.etcd/member
-- ::47.830368 I | etcdserver: heartbeat = 100ms
-- ::47.830388 I | etcdserver: election = 1000ms
-- ::
-- ::47.830435 I | etcdserver: advertise client URLs = http://192.168.6.129:2379
-- ::47.830477 I | etcdserver: initial advertise peer URLs = http://192.168.6.129:2380
-- ::47.830530 I | etcdserver: initial cluster = infra0=http://192.168.6.128:2380,infra1=http://192.168.6.129:2380,infra2=http://192.168.6.130:2380
-- ::47.836392 I | etcdserver: starting member c1d267ff57ac5bcc in cluster 24d40765d97551b1
-- ::
-- ::, commit: , applied: , lastindex: , lastterm: ]
-- ::
-- ::, cluster version: to_be_decided]
-- ::47.858946 E | etcdmain: failed to notify systemd for readiness: No socket
-- ::47.858966 E | etcdmain: forgot to set Type=notify in systemd service file?
-- ::47.862192 I | rafthttp: the connection with 205e265f32ab88c4 became active
-- ::47.862912 N | etcdserver: added member 205e265f32ab88c4 [http://192.168.6.128:2380] to cluster 24d40765d97551b1
-- ::47.863026 N | etcdserver: added member 277ba44edc63d7cd [http://192.168.6.130:2380] to cluster 24d40765d97551b1
-- ::47.863120 N | etcdserver: added local member c1d267ff57ac5bcc [http://192.168.6.129:2380] to cluster 24d40765d97551b1
-- ::: getsockopt: connection refused)
-- ::: getsockopt: connection refused)
-- ::
-- ::
-- ::
-- ::, index: ] sent vote request to 277ba44edc63d7cd at term
-- ::, index: ] sent vote request to 205e265f32ab88c4 at term
-- ::: getsockopt: connection refused)
-- ::] received a MsgVote message with higher term ]
-- ::
-- ::, index: , vote: ] voted , index: ] at term
-- ::
-- ::48.181204 I | etcdserver: published {Name:infra1 ClientURLs:[http://192.168.6.129:2379]} to cluster 24d40765d97551b1
-- ::48.184526 N | etcdserver: set the initial cluster version to 2.1
-- ::01.448599 I | rafthttp: the connection with 277ba44edc63d7cd became active
-- ::03.207866 N | etcdserver: updated the cluster version from 2.1 to 2.2
3)在 192.168.6.130 上执行:
./etcd --name infra2 --initial-advertise-peer-urls http://192.168.6.130:2380 \
--listen-peer-urls http://192.168.6.130:2380 \
--listen-client-urls http://192.168.6.130:2379,http://127.0.0.1:2379 \
--advertise-client-urls http://192.168.6.130:2379 \
--initial-cluster-token etcd-cluster- \
--initial-cluster infra0=http://192.168.6.128:2380,infra1=http://192.168.6.129:2380,infra2=http://192.168.6.130:2380 \
--initial-cluster-state new
返回信息:
-- ::
-- ::01.402651 I | etcdmain: Git SHA: 75f8282
-- ::01.402677 I | etcdmain: Go Version: go1.5.1
-- ::01.402691 I | etcdmain: Go OS/Arch: linux/amd64
-- ::, total number of available CPUs
-- ::01.402736 W | etcdmain: no data-dir provided, using default data-dir ./infra2.etcd
-- ::01.402972 I | etcdmain: listening for peers on http://192.168.6.130:2380
-- ::01.403070 I | etcdmain: listening for client requests on http://127.0.0.1:2379
-- ::01.403145 I | etcdmain: listening for client requests on http://192.168.6.130:2379
-- ::01.408318 I | etcdserver: name = infra2
-- ::01.408354 I | etcdserver: data dir = infra2.etcd
-- ::01.408364 I | etcdserver: member dir = infra2.etcd/member
-- ::01.408372 I | etcdserver: heartbeat = 100ms
-- ::01.408379 I | etcdserver: election = 1000ms
-- ::
-- ::01.408422 I | etcdserver: advertise client URLs = http://192.168.6.130:2379
-- ::01.408440 I | etcdserver: initial advertise peer URLs = http://192.168.6.130:2380
-- ::01.408479 I | etcdserver: initial cluster = infra0=http://192.168.6.128:2380,infra1=http://192.168.6.129:2380,infra2=http://192.168.6.130:2380
-- ::01.421508 I | etcdserver: starting member 277ba44edc63d7cd in cluster 24d40765d97551b1
-- ::
-- ::, commit: , applied: , lastindex: , lastterm: ]
-- ::
-- ::, cluster version: to_be_decided]
-- ::01.448691 E | etcdmain: failed to notify systemd for readiness: No socket
-- ::01.448707 E | etcdmain: forgot to set Type=notify in systemd service file?
-- ::01.451690 I | rafthttp: the connection with 205e265f32ab88c4 became active
-- ::01.454571 N | etcdserver: added member 205e265f32ab88c4 [http://192.168.6.128:2380] to cluster 24d40765d97551b1
-- ::01.454801 N | etcdserver: added local member 277ba44edc63d7cd [http://192.168.6.130:2380] to cluster 24d40765d97551b1
-- ::01.454895 N | etcdserver: added member c1d267ff57ac5bcc [http://192.168.6.129:2380] to cluster 24d40765d97551b1
-- ::01.456262 I | rafthttp: the connection with c1d267ff57ac5bcc became active
-- ::] received a MsgHeartbeat message with higher term ]
-- ::
-- ::
-- ::01.502371 N | etcdserver: set the initial cluster version to 2.1
-- ::01.506410 I | etcdserver: published {Name:infra2 ClientURLs:[http://192.168.6.130:2379]} to cluster 24d40765d97551b1
-- ::03.214718 N | etcdserver: updated the cluster version from 2.1 to 2.2
4. 退出 tmux 后台模式
Ctrl + b 再按 d 键
附:tmux 帮助
1)查看存在的 session
# tmux ls
返回信息:

2)删除某个 session
# tmux kill-session -t $session_name
3)进入某个 session
# tmux attach -t $session_name
第五步:在初始化 k8s
1. 为 192.168.6.128 网卡增加 IP
# ip addr add 192.168.6.132 dev eno16777736
查看网卡:

2. 初始化
1)执行初始化命令
# kubeadm init --api-advertise-addresses=192.168.6.131 --external-etcd-endpoints=http://192.168.6.128:2379,http://192.168.6.129:2379,http://192.168.6.130:2379 --use-kubernetes-version v1.5.1
返回信息:

Flag --external-etcd-endpoints has been deprecated, this flag will be removed when componentconfig exists
[kubeadm] WARNING: kubeadm is in alpha, please do not use it for production clusters.
[preflight] Running pre-flight checks
[preflight] WARNING: kubelet service is not enabled, please run 'systemctl enable kubelet.service'
[preflight] Starting the kubelet service
[init] Using Kubernetes version: v1.5.1
[tokens] Generated token: "e2e92d.d96382dcac25aa22"
[certificates] Generated Certificate Authority key and certificate.
[certificates] Generated API Server key and certificate
[certificates] Generated Service Account signing keys
[certificates] Created keys and certificates in "/etc/kubernetes/pki"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/kubelet.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/admin.conf"
[apiclient] Created API client, waiting for the control plane to become ready
[apiclient] All control plane components are healthy after 22.501928 seconds
[apiclient] Waiting for at least one node to register and become ready
[apiclient] First node is ready after 0.509735 seconds
[apiclient] Creating a test deployment
[apiclient] Test deployment succeeded
[token-discovery] Created the kube-discovery deployment, waiting for it to become ready
[token-discovery] kube-discovery is ready after 3.503953 seconds
[addons] Created essential addon: kube-proxy
[addons] Created essential addon: kube-dns
Your Kubernetes master has initialized successfully!
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
http://kubernetes.io/docs/admin/addons/
You can now join any number of machines by running the following on each node:
kubeadm join --token=e2e92d.d96382dcac25aa22 192.168.6.131
其中,切记:kubeadm join --token=e2e92d.d96382dcac25aa22 192.168.6.131
2)添加 kubelet 服务
# systemctl enable kubelet.service
返回信息:

3)查看 nodes
# kubectl get nodes
返回信息:

4)查看 pods
# kubectl get pods --all-namespaces
返回信息:

3. 配置 192.168.6.129 的 k8s
1)停止 k8s 服务
# systemctl stop kubelet
2)将 192.168.6.128 上的 /etc/kubernetes 目录复制到 192.168.6.129 上
3)重启 k8s 服务
# systemctl start kubelet
3)查看 nodes
# kubectl get nodes
返回信息:

4)查看 pods
# kubectl get pods --all-namespaces
返回信息:

4. 在 192.168.6.130 上启动 k8s 服务,并加入集群
1)执行上述切记的脚本:
# kubeadm join --token=e2e92d.d96382dcac25aa22 192.168.6.131
返回信息:

2)查看 nodes
# kubectl get nodes
返回信息:

第六步:添加 calico
1. 修改 calico.yaml
找到 etcd_endpoints 字段,修改成应的 IP:
etcd_endpoints: "http://192.168.6.128:2379,http://192.168.6.129:2379,http://192.168.6.130:2379"
2. 在主节点(192.168.6.128)添加 calico.yaml
# kubectl apply -f calico.yaml
返回信息:

3. 在主节点(192.168.6.128)添加 busybox.yaml
# kubectl create -f busybox.yaml
返回信息:

4. 查看 pods
# kubectl get pods --all-namespaces
返回信息:

第七步:kubuctl 其他配置
1. 目前 deploy/kube-dns 只有主节点上有,需进行扩容 kube-dns
1)执行命令
# kubectl scale deploy/kube-dns --replicas= -n kube-system
返回信息:

2)查看 pods
# kubectl get pods --all-namespaces
返回信息:

2. 目前 deploy/kube-discovery 只有主节点上有,需进行扩容 kube-discovery
1)执行命令
# kubectl scale deploy/kube-discovery --replicas= -n kube-system
返回信息:

2)查看 pods
# kubectl get pods --all-namespaces
返回信息:

3. 给另一个主节点打主节点标签
1)在 192.168.6.129 执行
# kubectl label node 192-168-6-129.master kubeadm.alpha.kubernetes.io/role=master
返回信息:

2)重启 192.168.6.129 上的 docker 服务
# systemctl restart docker
3)查看 nodes
# kubectl get nodes
返回信息:

4. 设置主节点可调节度
即设置应用也能在主节点上运行。
# kubectl taint nodes --all dedicated-
返回信息:

此时,kubernetes 组件已成功添加完成!
构建Docker平台【第三篇】安装 kubernetes 组件的更多相关文章
- 构建Docker平台【第二篇】安装 Docker
第一步:上传安装包和 docker 镜像 1.安装包: docker-engine-1.12.1-1.el7.centos.x86_64.rpm docker-engine-selinux-1.12. ...
- 构建Docker平台【第一篇】环境准备
主机信息 操作系统版本 CentOS-7-x86_64-Everything-1511 主机A 192.168.6.128 主节点 主机B 192.168.6.129 主节点 主机C 192.16 ...
- Docker实战 | 第三篇:Docker安装Nginx,实现基于vue-element-admin框架构建的项目线上部署
一. 前言 在上一文中 点击跳转 通过IDEA集成Docker插件实现微服务的一键部署,但 youlai-mall 是前后端分离的项目,除了后端微服务的部署之外,当然还少不了前端工程的部署.所以本篇讲 ...
- 构建Docker平台【第四篇】创建服务及扩缩容等操作
第一步:创建服务 1. 配置 nginx 的 yaml 文件 apiVersion: extensions/v1beta1 kind: Deployment metadata: name: my-ng ...
- 【Docker】第三篇 Docker容器管理
一.Docker容器概述: 简单理解容器是镜像的一个实例. 镜像是静态的只读文件,而容器的运行需要可写文件层. 二.创建容器 [root@web130 ~]# docker create -it ub ...
- Flask第三篇——安装Flask
现在我们来安装Flask: Windows系统安装Flask 如果你的系统是Windows,那安装起来非常方便——pip install flask Mac系统安装Flask Mac安装Flask一般 ...
- Sharepoint 2013 安装部署系列篇 第三篇 -- 安装和配置网络负载均衡在前端web服务器
第一部分 系统集群安装 第二部分 SQL集群安装 第四部分 安装和配置sharepoint 场(三层拓扑部署) 接下来一步一步开始配置NLB吧, 以下开始讲解如何配置NLB集群作为sharepoint ...
- kafka第三篇--安装使用
说明:直接下载二进制包可省略安装过程,省略很多麻烦. 1单机 安装 安装过程,参考官网: > tar xzf kafka-<VERSION>.tgz > cd kafka-&l ...
- elasticsearch 第三篇(安装篇)
*nux下安装 在*nux下,es官方已提供编译的deb和rpm包,但是需要保证已安装安装Java虚拟环境(目前es1.6和1.7版本均可选择1.8版本java),安装步骤如下:1.下载ES deb/ ...
随机推荐
- HTML5+MUI+HBuilder 之初探情人
07,08年那会儿正当Java火爆,C/C++仍是广泛运用的一门语言的时候,所以 我的大学都献给了C/C++和Java.当诺基亚的倒闭成为按键机时代衰落的标志时,移动APP的开发也如破堤之洪,爆炸式的 ...
- 前言《iOS网络高级编程:iPhone和iPad的企业应用开发》(书籍学习)
本书内容: 在客户端设备与服务器之间执行HTTP请求 管理客户端设备与服务器之间的数据负载 处理HTTP请求的错误 保护网络通信 改进网络通信的性能 执行Socket层的通信 实现推送通知 单个设备上 ...
- php刷新当前页面
echo "<script language=JavaScript> location.replace(location.href);</script>"; ...
- js原生设计模式——9外观模式封装
1.事件处理程序兼容性封装 <!DOCTYPE html><html lang="en"><head> <meta charset= ...
- jQuery html text val方法使用
jQuery html text val方法使用 <%@ page language="java" import="java.util.*" pageEn ...
- 一步一步Asp.Net MVC系列_权限管理设计
http://www.cnblogs.com/mysweet/archive/2012/07/26/2610793.html
- Oracle中 Instr 这个函数
http://www.jb51.net/article/42369.htm sql :charindex('字符串',字段)>0 charindex('administrator',MUserI ...
- jQuery获取URL中所带参数的办法
可以使用正则表达式进行结果的拆分: http://www.cnblogs.com/babycool/p/3169058.html 可以直接进行所需内容的split: http://blog.scien ...
- OpenCV框架介绍
OpenCV框架介绍 概述 OpenCV是一个开放源代码的计算机视觉应用平台,由英特尔公司下属研发中心俄罗斯团队发起该项目,开源BSD证书,OpenCV的目标是实现实时计算机视觉,,是一个跨平台的计算 ...
- Bootstrap入门(十五)组件9:面板组件
Bootstrap入门(十五)组件9:面板组件 虽然不总是必须,但是某些时候你可能需要将某些 DOM 内容放到一个盒子里.对于这种情况,可以试试面板组件. 1.基本实例 2.带标题的面板 3.情景效果 ...