当前位置: 首页 > news >正文

怎样用电脑和网訨自己做网站重庆百度推广排名优化

怎样用电脑和网訨自己做网站,重庆百度推广排名优化,泛华建设集团网站,贵州网站设计公司一.系统环境 本文主要基于Kubernetes1.21.9和Linux操作系统CentOS7.4。 服务器版本docker软件版本Kubernetes(k8s)集群版本CPU架构CentOS Linux release 7.4.1708 (Core)Docker version 20.10.12v1.21.9x86_64CI/CD解决方案架构图:CI/CD解决方案架构图描述:程序员写好代码之…

一.系统环境

本文主要基于Kubernetes1.21.9和Linux操作系统CentOS7.4。

服务器版本docker软件版本Kubernetes(k8s)集群版本CPU架构
CentOS Linux release 7.4.1708 (Core)Docker version 20.10.12v1.21.9x86_64

CI/CD解决方案架构图:
CI/CD解决方案架构图描述:
程序员写好代码之后,向gitlab代码仓库提交代码,gitlab检测到变化之后,触发CI/CD服务器Jenkins,CI/CD服务器
Jenkins构建镜像,镜像构建好之后推送到registry镜像仓库,最后使用新的镜像在Kubernetes(k8s)环境部署。
CI/CD解决方案架构:k8scloude1作为Kubernetes(k8s)的master节点,k8scloude2,k8scloude3作为Kubernetes(k8s)的worker节点,由于机器有限,etcd1作为CI/CD服务器,镜像仓库,代码仓库。

服务器操作系统版本CPU架构进程功能描述
etcd1/192.168.110.133CentOS Linux release 7.4.1708 (Core)x86_64docker,jenkinsCI/CD服务器
etcd1/192.168.110.133CentOS Linux release 7.4.1708 (Core)x86_64registry镜像仓库
etcd1/192.168.110.133CentOS Linux release 7.4.1708 (Core)x86_64gitlab,Git代码仓库
k8scloude1/192.168.110.130CentOS Linux release 7.4.1708 (Core)x86_64docker,kube-apiserver,etcd,kube-scheduler,kube-controller-manager,kubelet,kube-proxy,coredns,calicok8s master节点
k8scloude2/192.168.110.129CentOS Linux release 7.4.1708 (Core)x86_64docker,kubelet,kube-proxy,calicok8s worker节点
k8scloude3/192.168.110.128CentOS Linux release 7.4.1708 (Core)x86_64docker,kubelet,kube-proxy,calicok8s worker节点

二.前言

DevOps是一种将开发(Development)和运维(Operations)相结合的软件开发方法论。它通过自动化和持续交付的方式,将软件开发、测试和部署等环节紧密集成,以提高效率和产品质量。在本篇博客中,我们将介绍如何使用GitLab、Jenkins和Kubernetes(k8s)来构建一个完整的CI/CD解决方案。
使用GitLab、Jenkins和Kubernetes(k8s)来构建CI/CD解决方案的前提是已经有一套可以正常运行的Kubernetes集群,关于Kubernetes(k8s)集群的安装部署,可以查看博客《Centos7 安装部署Kubernetes(k8s)集群》https://www.cnblogs.com/renshengdezheli/p/16686769.html。

三.DevOps简介

DevOps通过打破开发和运维之间的壁垒,促进了更紧密的合作和快速响应变化的能力。它强调团队间的协作、自动化和持续改进。通过引入DevOps实践,组织可以更快地交付软件,并确保高质量的发布。

四.CI/CD简介

CI/CD代表持续集成(Continuous Integration)和持续交付(Continuous Delivery)。持续集成是指团队成员将其工作频繁地集成到共享存储库中,并进行自动化构建和测试,以减少集成问题。持续交付是指将应用程序更频繁地交付给用户,以便快速获得反馈并提供新功能。本次使用的CI/CD工具为Jenkins。

五.安装并配置docker参数

etcd1机器作为集成服务器,需要下载大量镜像,所以首先需要安装docker,docker版本标识:社区版 docker-ce 和企业版 docker-ee。

[root@etcd1 ~]# yum -y install docker-ce

为了让镜像下载速度变快,需要配置镜像加速器,关于docker更多详细内容,请查看博客《一文搞懂docker容器基础:docker镜像管理,docker容器管理》。

[root@etcd1 ~]# vim /etc/docker/daemon.json[root@etcd1 ~]# cat /etc/docker/daemon.json 
{
"registry-mirrors": ["https://frz7i079.mirror.aliyuncs.com"] 
}

重启docker使配置生效。

[root@etcd1 ~]# systemctl restart docker[root@etcd1 ~]# systemctl status docker
● docker.service - Docker Application Container EngineLoaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)Active: active (running) since 六 2022-03-26 17:53:49 CST; 40s agoDocs: https://docs.docker.comMain PID: 1495 (dockerd)Memory: 32.9MCGroup: /system.slice/docker.service└─1495 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

设置docker开机自启动

[root@etcd1 ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

修改docker启动脚本,–insecure-registry=192.168.110.133:5000是镜像仓库的地址, 我们使用registry搭建镜像仓库,添加了–insecure-registry=192.168.110.133:5000参数之后,就可以使用http的方式拉取镜像,不然默认使用https的方式拉取镜像。
jenkins需要做的工作:构建,编译,推送,这些操作都需要借助docker去完成,但是jenkins自身是没有docker命令的,要让jenkins连接到物理机的docker上,需要添加参数:-H tcp://0.0.0.0:2376。

[root@etcd1 ~]# vim /usr/lib/systemd/system/docker.service[root@etcd1 ~]# cat /usr/lib/systemd/system/docker.service
.....
ExecStart=/usr/bin/dockerd --insecure-registry=192.168.110.133:5000 -H tcp://0.0.0.0:2376  -H fd:// --containerd=/run/containerd/containerd.sock
.....

重新加载配置文件,重启docker。

[root@etcd1 ~]# systemctl daemon-reload ;systemctl restart docker

查看状态可以发现:8083 /usr/bin/dockerd --insecure-registry=192.168.110.133:5000 -H tcp://0.0.0.0:2376 -H fd:// --containerd=/run/containerd/containerd.sock,修改参数成功。

[root@etcd1 ~]# systemctl status docker
● docker.service - Docker Application Container EngineLoaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)Active: active (running) since 二 2022-03-29 11:37:51 CST; 20s agoDocs: https://docs.docker.comMain PID: 8083 (dockerd)Memory: 36.8MCGroup: /system.slice/docker.service└─8083 /usr/bin/dockerd --insecure-registry=192.168.110.133:5000 -H tcp://0.0.0.0:2376 -H fd:// --containerd=/run/containerd/containerd.sock

我们把镜像推送到registry镜像仓库之后,k8s集群的worker节点会向registry镜像仓库拉取镜像,默认使用https的方式从镜像仓库拉取镜像,需要在k8s的worker节点修改docker启动参数,添加–insecure-registry=192.168.110.133:5000,让其使用http的方式从registry镜像仓库拉取镜像。

[root@k8scloude2 ~]# vim /usr/lib/systemd/system/docker.service[root@k8scloude2 ~]# cat /usr/lib/systemd/system/docker.service
......
ExecStart=/usr/bin/dockerd --insecure-registry=192.168.110.133:5000  -H fd:// --containerd=/run/containerd/containerd.sock
......[root@k8scloude2 ~]# grep ExecStart /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd --insecure-registry=192.168.110.133:5000  -H fd:// --containerd=/run/containerd/containerd.sock

重新加载配置文件,重启docker。

[root@k8scloude2 ~]# systemctl daemon-reload ;systemctl restart docker[root@k8scloude2 ~]# systemctl status docker
● docker.service - Docker Application Container EngineLoaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)Active: active (running) since 二 2022-03-29 11:51:36 CST; 4s agoDocs: https://docs.docker.comMain PID: 57510 (dockerd)Memory: 63.6MCGroup: /system.slice/docker.service├─57510 /usr/bin/dockerd --insecure-registry=192.168.110.133:5000 -H fd:// --containerd=/run/containerd/containerd.sock├─57759 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 80 -container-ip 172.17.0.2 -container-port 80└─57767 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 80 -container-ip 172.17.0.2 -container-port 80

k8scloude3节点也需要修改docker启动参数,添加–insecure-registry=192.168.110.133:5000,让其使用http的方式从registry镜像仓库拉取镜像。

[root@k8scloude3 ~]# vim /usr/lib/systemd/system/docker.service[root@k8scloude3 ~]# grep ExecStart /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd --insecure-registry=192.168.110.133:5000  -H fd:// --containerd=/run/containerd/containerd.sock

重新加载配置文件,重启docker。

[root@k8scloude3 ~]# systemctl daemon-reload ;systemctl restart docker[root@k8scloude3 ~]# systemctl status docker
● docker.service - Docker Application Container EngineLoaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)Active: active (running) since 二 2022-03-29 15:55:13 CST; 5s agoDocs: https://docs.docker.comMain PID: 9099 (dockerd)Memory: 43.1MCGroup: /system.slice/docker.service└─9099 /usr/bin/dockerd --insecure-registry=192.168.110.133:5000 -H fd:// --containerd=/run/containerd/containerd.sock

现在k8s集群的所有worker节点都加上了–insecure-registry=192.168.110.133:5000参数。
在etcd1机器拉取nginx镜像,之后做web容器的时候会用到。

[root@etcd1 ~]# docker pull nginx
Using default tag: latest
......
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest[root@etcd1 ~]# docker images | grep nginx
nginx                            latest                605c77e624dd   3 months ago   141MB

六.使用registry搭建镜像仓库

本次使用registry搭建镜像仓库,也可以使用harbor搭建镜像仓库,功能更丰富,关于harbor的详细内容,请查看博客《搭建docker镜像仓库(二):使用harbor搭建本地镜像仓库》。
拉取registry镜像

[root@etcd1 ~]# docker pull hub.c.163.com/library/registry:latest      [root@etcd1 ~]# docker images | grep registry
hub.c.163.com/library/registry   latest                751f286bc25e   4 years ago    33.2MB

注意:registry的数据卷为:VOLUME [/var/lib/registry],不能是其他的。
创建registry容器,registry镜像生成容器作为私有仓库,-p 5000:5000做端口映射,物理机端口5000:容器端口5000,
-v /myregistry:/var/lib/registry数据卷挂载,物理机目录/myregistry:容器目录/var/lib/registry。

[root@etcd1 ~]# docker run -d --name registry -p 5000:5000 --restart=always -v /myregistry:/var/lib/registry hub.c.163.com/library/registry
3aa799d1974611fc403ce38aa19a156cb165a82573b84b16fde665d9e3b62eb0

现在registry镜像仓库就搭建好了。

[root@etcd1 ~]# docker ps | grep registry
3aa799d19746   hub.c.163.com/library/registry   "/entrypoint.sh /etc…"   8 seconds ago   Up 7 seconds           0.0.0.0:5000->5000/tcp, :::5000->5000/tcp                                                                         registry

此时镜像仓库下还没有任何文件

[root@etcd1 ~]# ls /myregistry/

七.安装部署gitlab代码仓库

7.1 创建gitlab容器

在etcd1机器下载gitlab中文版镜像

[root@etcd1 ~]# docker pull beginor/gitlab-ce     [root@etcd1 ~]# docker images | grep gitlab
beginor/gitlab-ce                latest                5595d4ff803e   3 years ago    1.5GB

创建gitlab配置文件目录,日志目录,代码目录

[root@etcd1 ~]# mkdir -p /data/gitlab/etc /data/gitlab/log /data/gitlab/data

给gitlab配置文件目录,日志目录,代码目录授予777权限

[root@etcd1 ~]# chmod 777 /data/gitlab/etc /data/gitlab/log /data/gitlab/data

创建gitlab容器,使用–privileged=true参数,使container内的root拥有真正的root权限。否则,container内的root只是外部的一个普通用户权限。–privileged=true启动的容器,可以看到很多host上的设备,并且可以执行mount。甚至允许你在docker容器中启动docker容器。
-v指定数据卷,gitlab容器的配置文件,日志文件,数据文件也都存储到了物理机上,我们修改对应数据卷的内容,gitlab容器的相关内容也随之改变。-p指定端口映射。

[root@etcd1 ~]# docker run -dit --name=gitlab --restart=always -p 8443:443 -p 80:80 -p 222:22 -v /data/gitlab/etc:/etc/gitlab -v /data/gitlab/log:/var/log/gitlab -v /data/gitlab/data:/var/opt/gitlab --privileged=true beginor/gitlab-ce

查看gitlab容器

[root@etcd1 ~]# docker ps | grep gitlab
d23f2df47e42   beginor/gitlab-ce                "/assets/wrapper"        22 hours ago    Up 6 hours (healthy)   0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:222->22/tcp, :::222->22/tcp, 0.0.0.0:8443->443/tcp, :::8443->443/tcp   gitlab

现在gitlab配置文件目录,日志目录,代码目录都有相关文件了。

[root@etcd1 ~]# ls /data/gitlab/etc/
gitlab.rb  gitlab-secrets.json  ssh_host_ecdsa_key  ssh_host_ecdsa_key.pub  ssh_host_ed25519_key  ssh_host_ed25519_key.pub  ssh_host_rsa_key  ssh_host_rsa_key.pub  trusted-certs[root@etcd1 ~]# ls /data/gitlab/log/
gitaly  gitlab-monitor  gitlab-rails  gitlab-shell  gitlab-workhorse  logrotate  nginx  node-exporter  postgres-exporter  postgresql  prometheus  reconfigure  redis  redis-exporter  sidekiq  sshd  unicorn[root@etcd1 ~]# ls /data/gitlab/data/
backups       gitaly    gitlab-ci       gitlab-rails  gitlab-workhorse  nginx          postgres-exporter  prometheus              redis
bootstrapped  git-data  gitlab-monitor  gitlab-shell  logrotate         node-exporter  postgresql         public_attributes.json  trusted-certs-directory-hash

7.2 修改gitlab容器配置文件

注意先让gitlab容器运行一段时间,让其数据进行初始化,然后再停止gitlab容器,修改配置文件。

[root@etcd1 ~]# docker stop gitlab

下面开始修改gitlab的配置文件。
修改/data/gitlab/etc/gitlab.rb&#x


文章转载自:
http://rattled.fzLk.cn
http://portapak.fzLk.cn
http://auscultation.fzLk.cn
http://unswayed.fzLk.cn
http://isolantite.fzLk.cn
http://trouper.fzLk.cn
http://chlorophyllous.fzLk.cn
http://citramontane.fzLk.cn
http://outdrop.fzLk.cn
http://ramayana.fzLk.cn
http://bias.fzLk.cn
http://orcin.fzLk.cn
http://riverweed.fzLk.cn
http://superfine.fzLk.cn
http://iise.fzLk.cn
http://eudaemonic.fzLk.cn
http://squarson.fzLk.cn
http://icteric.fzLk.cn
http://cuvette.fzLk.cn
http://aggregately.fzLk.cn
http://use.fzLk.cn
http://rhizocarpous.fzLk.cn
http://votaress.fzLk.cn
http://tonsorial.fzLk.cn
http://sawan.fzLk.cn
http://tuum.fzLk.cn
http://orchestra.fzLk.cn
http://cattle.fzLk.cn
http://motivate.fzLk.cn
http://antiphonic.fzLk.cn
http://salubrious.fzLk.cn
http://dataroute.fzLk.cn
http://valorisation.fzLk.cn
http://flabellinerved.fzLk.cn
http://pipestone.fzLk.cn
http://presbytery.fzLk.cn
http://abdominal.fzLk.cn
http://progressionist.fzLk.cn
http://henbane.fzLk.cn
http://undersheriff.fzLk.cn
http://nyassa.fzLk.cn
http://piper.fzLk.cn
http://confection.fzLk.cn
http://cyprinid.fzLk.cn
http://lung.fzLk.cn
http://shapeliness.fzLk.cn
http://inflationist.fzLk.cn
http://convoke.fzLk.cn
http://thiamin.fzLk.cn
http://swan.fzLk.cn
http://sphagna.fzLk.cn
http://trinitarian.fzLk.cn
http://recheat.fzLk.cn
http://mithraistic.fzLk.cn
http://sokol.fzLk.cn
http://coefficient.fzLk.cn
http://subnitrate.fzLk.cn
http://unwrought.fzLk.cn
http://soubriquet.fzLk.cn
http://conciliationism.fzLk.cn
http://sweeten.fzLk.cn
http://virosis.fzLk.cn
http://wretched.fzLk.cn
http://popinjay.fzLk.cn
http://moore.fzLk.cn
http://bibliograph.fzLk.cn
http://uninfluenced.fzLk.cn
http://rotogravure.fzLk.cn
http://germicidal.fzLk.cn
http://eight.fzLk.cn
http://coho.fzLk.cn
http://kundalini.fzLk.cn
http://possibly.fzLk.cn
http://moule.fzLk.cn
http://lineolate.fzLk.cn
http://outbuild.fzLk.cn
http://crypto.fzLk.cn
http://albigensian.fzLk.cn
http://indue.fzLk.cn
http://abiotrophy.fzLk.cn
http://bndd.fzLk.cn
http://endoscope.fzLk.cn
http://audiotape.fzLk.cn
http://spiritous.fzLk.cn
http://postnasal.fzLk.cn
http://caponata.fzLk.cn
http://unfixed.fzLk.cn
http://antistrophe.fzLk.cn
http://lucigen.fzLk.cn
http://calorify.fzLk.cn
http://predicably.fzLk.cn
http://algometrical.fzLk.cn
http://ordinary.fzLk.cn
http://shortage.fzLk.cn
http://ah.fzLk.cn
http://rhizocephalan.fzLk.cn
http://pokie.fzLk.cn
http://epiblast.fzLk.cn
http://avarice.fzLk.cn
http://euploid.fzLk.cn
http://www.dt0577.cn/news/71891.html

相关文章:

  • 烟台建设科技网站百度seo排名软
  • 做p2p投资理财的网站好搜seo软件
  • 制作一个网站需要多久搜索引擎调价平台哪个好
  • 邮件格式模板武汉seo价格
  • 阳泉市编办网站三基建设广东seo推广费用
  • 网站建设英文名词百度seo网站优化 网络服务
  • ps做汽车网站下载今日小说搜索风云榜
  • app制作平台靠谱吗北京seo网络推广
  • 建设部网站关于公租房跨境电商培训
  • 仿牌网站空间深圳外贸推广公司
  • xml做web网站怎么查网站是不是正规
  • 昭通公司做网站seo新人怎么发外链
  • wordpress提交360做网站排名优化的公司
  • 如何搜索公司所有的网站有源码怎么搭建网站
  • 有没有做3d衣服模型网站seo推广平台服务
  • 做个网站上百度怎么做手机端网站优化
  • 做油漆的网站搭建一个app平台要多少钱
  • 免费软件不收费网站国内搜索网站排名
  • 免费做橙光封面的网站网店seo排名优化
  • 网站的优化与网站建设有关吗seo3
  • 做教程网站资源放哪里有怎么在百度做广告
  • 大鹏教育平面设计官网市场seo是什么
  • 网站被挟持怎么办关联词有哪些关系
  • 鹤山网站建设北京网站seo费用
  • 福州官网建站厂开鲁网站seo站长工具
  • 建设网站英语网络营销课程培训机构
  • 最便宜的网站建设公司网文网站排名
  • php快速建网站营销课程培训都有哪些
  • 做电子网站的banner图新手seo要学多久
  • 黄石网站设计制作公司培训教育机构