K8S部署:
可按照下面大概流程操作。
安装 node-0001 … node-0005 (2cpu,4G内存)
安装 docker
yum -y remove firewalld-*
yum install docker
开启路由转发
添加 echo “net.ipv4.ip_forward = 1” >> /etc/sysctl.conf
修改 /lib/systemd/system/docker.service
ExecStart…..后面
添加ExecStartPost=/sbin/iptables -P FORWARD ACCEPT
重新加载服务 systemctl daemon-reload
添加私有仓库地址 /etc/sysconfig/docker
ADD_REGISTRY=’–add-registry 192.168.1.100:5000′
INSECURE_REGISTRY=’–insecure-registry 192.168.1.100:5000′
安装私有仓库 192.168.1.100(1cpu,1G内存)
yum -y remove firewalld-*
yum install docker-distribution
开启路由转发
/etc/sysctl.conf
添加 net.ipv4.ip_forward = 1
镜像制作
busybox:latest
docker tag docker.io/busybox:latest repo:5000/busybox:latest
docker push repo:5000/busybox:latest
myos:latest
配置yum源
安装常用软件包
yum -y install net-tools bash-completion psmisc iproute vim
myos:httpd(apache + php)
FROM myos:latest #指定myos就可以省去配置yum源
RUN yum install -y httpd php #安装apache服务
ENV LANG=C #设置环境变量
ADD webhome.tar.gz /var/www/html/#安装网页文件,会自动解压
WORKDIR /var/www/html/ #指定工作目录
EXPOSE 80 #声明开放的端口
CMD [“httpd”, “-DFOREGROUND”] #容器启动命令
myos:php-fpm
FROM myos:latest
RUN yum install -y php-fpm && mkdir -p /usr/local/nginx/html
COPY www.conf /etc/php-fpm.d/www.conf
EXPOSE 9000
WORKDIR /usr/local/nginx/html
CMD [“/usr/sbin/php-fpm”, “–nodaemonize”]
myos:nginx
FROM myos:latest
RUN yum install -y pcre openssl && useradd nginx
ADD nginx.tar.gz /usr/local/
EXPOSE 80
WORKDIR /usr/local/nginx/html
CMD [“/usr/local/nginx/sbin/nginx”, “-g”, “daemon off;”]