0%

centos 7.3安装dcos 1.9

安装条件

  1. centos 7.3 系统下载

    https://mirrors.sohu.com/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1611.iso

  2. 安装文档

    https://dcos.io/docs/1.9/installing/custom/system-requirements/

  3. 关闭 selinux

1
2
3
4
5
sudo sed -i s/SELINUX=enforcing/SELINUX=permissive/g /etc/selinux/config
setenforce 0

查看selinux状态
getenforce
  1. 关闭防火墙
1
sudo systemctl stop firewalld && sudo systemctl disable firewalld
  1. 取消 sudo 密码提示
1
2
3
vi /etc/sudoers
增加
%wheel ALL=(ALL) NOPASSWD: ALL
  1. 安装 ntp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
sudo yum -y install ntp
systemctl enable ntpd && systemctl start ntpd

检查ntp服务,NTP enabled
timedatectl

[root@localhost ~]# timedatectl
Local time: Thu 2017-06-22 15:19:53 CST
Universal time: Thu 2017-06-22 07:19:53 UTC
RTC time: Thu 2017-06-22 07:19:51
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
  1. 安装软件及一些工具(安装过程中自动安装,提前安装)
1
2
sudo yum install -y tar xz unzip curl ipset
sudo yum -y install bind bind-utils
  1. bootstrap node ssh 免密码登录其它 master node agent node
1
2
ssh-keygen 生成密钥
ssh-copy-id root@(其他节点)

ssh 由于 dns 解析连接速度慢,关闭 sshd dns 解析

1
2
3
vi /etc/ssh/sshd_config
设置
useDNS no

安装 docker 1.13.1

安装文档

https://dcos.io/docs/1.9/installing/custom/system-requirements/install-docker-centos/

  1. Upgrade CentOS to 7.3:
1
2
sudo yum upgrade --assumeyes --tolerant
sudo yum update --assumeyes
  1. Verify that the kernel is at least 3.10:
1
2
uname -r
3.10.0-514.el7.x86_64
  1. Enable OverlayFS:
1
2
3
sudo tee /etc/modules-load.d/overlay.conf <<-'EOF'
overlay
EOF
  1. Reboot to reload kernel modules:
1
reboot
  1. Verify that OverlayFS is enabled:
1
2
lsmod | grep overlay
overlay
  1. Configure yum to use the Docker yum repo:
1
2
3
4
5
6
7
8
sudo tee /etc/yum.repos.d/docker.repo <<-'EOF'
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF
  1. Configure systemd to run the Docker Daemon with OverlayFS:
1
2
3
4
5
sudo mkdir -p /etc/systemd/system/docker.service.d && sudo tee /etc/systemd/system/docker.service.d/override.conf <<- EOF
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd --storage-driver=overlay
EOF
  1. Install the Docker engine, daemon, and service.
1
2
3
sudo yum install -y docker-engine-1.13.1 docker-engine-selinux-1.13.1
sudo systemctl start docker
sudo systemctl enable docker

When the process completes, you should see:

1
2
Complete!
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
  1. Test that Docker is properly installed:
1
sudo docker ps

运行 dcos 安装(gui 安装)

https://dcos.io/docs/1.9/installing/custom/gui/

  1. Download the DC/OS installer to your bootstrap node.
1
curl -O https://downloads.dcos.io/dcos/stable/dcos_generate_config.sh
  1. From your terminal, start the DC/OS GUI installer with this command.
1
sudo bash dcos_generate_config.sh --web

Here is an example of the output.

1
2
3
Running mesosphere/dcos-genconf docker with BUILD_DIR set to /home/centos/genconf
16:36:09 dcos_installer.action_lib.prettyprint:: ====> Starting DC/OS installer in web mode
16:36:09 root:: Starting server ('0.0.0.0', 9000)

Tip: You can add the verbose (-v) flag to see the debug output:

1
sudo bash dcos_generate_config.sh --web -v
  1. Launch the DC/OS web installer in your browser at: http://<bootstrap-node-public-ip>:9000

使用经验

  • 关于 dns 解析,增加自定义

使用 dnsmasq 自定义 dns,修改 dcos-spartan.service 配置文件/opt/mesosphere/etcspartan.json,由于 spartan 占用 master 53 端口,故 dnsmasq 使用 5353 端口

1
2
3
4
5
{
"upstream_resolvers": ["192.168.100.82:5353","8.8.8.8", "8.8.4.4"],
"udp_port": 53,
"tcp_port": 53
}
1
2
3
安装dnsmasq
vi /etc/dnsmasq.conf
设置端口为5353
  • 自定义 DNS 服务器必须加入 8.8.8.8 8.8.4.4

dcos 访问 Packages 需要经过 dcos.auth0.com 认证,114.114.114.114 不能解析该地址,出现 504(Gateway-timeout)

https://dcos.io/docs/1.7/administration/installing/custom/configure-proxy/

另外还可以配置 dcos-adminrouter nginx.master.conf 增加proxy_read_timeout 3600