Skip to content

Latest commit

 

History

History
84 lines (59 loc) · 2.89 KB

生产部署指引.md

File metadata and controls

84 lines (59 loc) · 2.89 KB

生产部署指引

一、Windows虚拟机部署

Windows-Vbox虚拟机(或Esxi/pve虚拟化)+ Barge-OS迷你容器系统, --network=host采用虚机IP

14M的ISO镜像(内置Docker): https://github.com/bargees/barge-os/releases/download/2.14.0-rc2/barge.iso

1)barge虚拟机配置

# step1: vbox设置, nat网卡共用宿主机IP, 配置端口转发: 10022>10022; 10081>10081; 10089>10089 (或选择桥接网卡,独立分配IP)

#下载barge-os.iso: https://github.com/bargees/barge-os/releases
# 13M barge_2.10.2.iso https://github.com/bargees/barge-os/releases/download/2.10.2/barge.iso #Docker v18.09.0-beta3
# 14M barge-2.14.0-rc2.iso https://github.com/bargees/barge-os/releases/download/2.14.0-rc2/barge.iso
# 33M barge-x.iso https://github.com/bargees/barge-os/releases/download/2.12.0-x/barge-x.iso

# step2: 进入系统后:fdisk /dev/sda
echo -e "n\np\n1\n\n\nw" |fdisk /dev/sda
mkfs.ext4 -b 4096 -i 4096 -F -L BARGE-DATA /dev/sda1 #none: e2label /dev/xxx1 LABEL1
mkswap -L BARGE-SWAP /dev/xxx

2)dbox容器配置

# 运行容器
vols="""
-v /:/mnt 
-v /mnt/data/dbox_ext:/_ext 
-v /mnt/data/dbox_opt:/opt 
"""
docker run -d --name=devbox --shm-size 1g \
--privileged --restart=always --net=host $vols \
infrastlabs/docker-headless:latest

# 配置Dind访问
# 宿主机:18.09.3? |docker-1.10.3 @barge
docker run -v /mnt/data/dbox_opt:/opt docker:1.10.3 sh -c "cp /usr/local/bin/docker /opt; ls -lh /opt"
docker run -v /opt:/opt docker:18.09.8 sh -c "cp /usr/local/bin/docker /opt; ls -lh /opt" #docker-18.09.8

# 容器内:
sudo ln -s /opt/docker /bin/
sudo ln -s /mnt/var/run/docker.sock /var/run/docker.sock
sudo chmod 777 /var/run/docker.sock

二、Linux服务器部署

容器使用macvlan网络,分配专用IP,建议安装lxcfs

  • 1.环境准备:服务器安装docker, 可再安装lxcfs、使用XFS文件系统以让容器支持CPU/MEM/DISK层面的资源限定隔离(用于胖容器环境)
  • 2.部署headless:采用docker-compose.yml做部署, docker采用macvlan网络,分配专用IP
# net
docker network create -d macvlan --subnet=172.25.20.0/22 --gateway=172.25.23.254 -o parent=vmbr0 macvlan1 

# test
docker run -it --rm --network=macvlan1 --ip=172.25.23.190 infrastlabs/alpine-ext

# coker-compose编排:
# .env 设定容器主机名、IP、CPU/内存限定参数
# docker-compose.yml 编排文件,礴lxcfs资源可视隔离(未装lxcfs请注释相关挂载路径)
docker-compose up #启动headless容器

三、Kubernetes环境部署

Deployment+Service

1.一条指令快速初始 (现有集群)

kc apply -k https://gitee.com/infrastlabs/docker-headless//deploy/k8s-headless #初始指令
kc -n default get po -w #跟进pod初始化进度

(注: kckubectl的简写: ln -s /usr/local/bin/kubectl kc, dcpdocker-compose简写)

2.无集群快速体验:初始k3s轻集群 > 执行上一步