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

网站博客程序2022年免费云服务器

网站博客程序,2022年免费云服务器,河北保定最新消息,立方米网站建设架构参考 使用hostnetwork,推荐的方式,使用单独的物理服务器,不部署业务pod的主机。 一、Ingress Nginx Controller 安装 采用helm的安装方式,进行部署。 官网地址: https://kubernetes.github.io/ingress-nginx/deploy/ github地址: https://github.com/kubernetes/in…

架构参考

在这里插入图片描述在这里插入图片描述
在这里插入图片描述

使用hostnetwork,推荐的方式,使用单独的物理服务器,不部署业务pod的主机。


一、Ingress Nginx Controller 安装

采用helm的安装方式,进行部署。

官网地址:
https://kubernetes.github.io/ingress-nginx/deploy/

在这里插入图片描述

github地址:
https://github.com/kubernetes/ingress-nginx

1. 首先安装 Helm(已安装)

# wget https://get.helm.sh/helm-v3.6.3-linux-amd64.tar.gz
# tar -zxvf helm-v3.0.0-linux-amd64.tar.gz
# mv linux-amd64/helm /usr/local/bin/helm[root@k8s-master01 ingress-nginx]#helm version
version.BuildInfo{Version:"v3.15.1", GitCommit:"e211f2aa62992bd72586b395de50979e31231829", GitTreeState:"clean", GoVersion:"go1.22.3"}

下载 Ingress Nginx Controller 安装包

[root@k8s-master01 ingress-up]#helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
"ingress-nginx" has been added to your repositories[root@k8s-master01 ingress-up]#helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "ingress-nginx" chart repository
...Successfully got an update from the "bitnami" chart repository
...Successfully got an update from the "grafana" chart repository
Update Complete. ⎈Happy Helming![root@k8s-master01 ingress-up]#helm repo list
NAME            URL
bitnami         https://charts.bitnami.com/bitnami
grafana         https://grafana.github.io/helm-charts
ingress-nginx   https://kubernetes.github.io/ingress-nginx#查看现有包版本
[root@k8s-master01 ingress]#helm search repo ingress-nginx
NAME                            CHART VERSION   APP VERSION     DESCRIPTION
ingress-nginx/ingress-nginx     4.11.2          1.11.2          Ingress controller for Kubernetes using NGINX a...[root@k8s-master01 ingress-up]#helm pull ingress-nginx/ingress-nginx --version 4.0.1
[root@k8s-master01 ingress-up]#ls
helm-v3.6.3-linux-amd64.tar.gz  ingress-nginx-4.0.1.tgz

更改对应的配置

[root@k8s-master01 ingress-up]#tar xf ingress-nginx-4.0.1.tgz
[root@k8s-master01 ingress-up]#cd ingress-nginx/
[root@k8s-master01 ingress-nginx]#ls
CHANGELOG.md  Chart.yaml  ci  OWNERS  README.md  templates  values.yaml
[root@k8s-master01 ingress-nginx]#vim values.yaml

在这里插入图片描述在这里插入图片描述在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

需要修改的位置

  1. Controller 和 admissionWebhook 的镜像地址,需要将公网镜像同步至公司内网镜像仓库(需要自行同步 gcr 镜像,一样的版本可以直接用registry.cn-beijing.aliyuncs.com/dotbalo/controller:v1.0.0registry.cn-beijing.aliyuncs.com/dotbalo/kube-webhook-certgen:v1.0
  2. 镜像的 digest 值注释#
  3. hostNetwork 设置为 true
  4. dnsPolicy 设置为 ClusterFirstWithHostNet,改了就能解析了
  5. NodeSelector 添加 ingress: "true"部署至指定节点
  6. 类型更改为 kind: DaemonSet
  7. 将 ingress nginx 设置为默认的default:true,如果有多个可以不用设置默认,不加需要再ingress配置文件上单独写指定。
# 部署 ingress,给需要部署 ingress 的节点上打标签
[root@k8s-master01 ingress-nginx]#kubectl label node k8s-node02 ingress=true
node/k8s-node02 labeled# 创建命名空间
[root@k8s-master01 ingress-nginx]#kubectl create ns ingress-nginx
Error from server (AlreadyExists): namespaces "ingress-nginx" already exists# 检查有没用helm装过
[root@k8s-master01 ingress-nginx]#helm list -n ingress-nginx
NAME  NAMESPACE REVISION UPDATED STATUS CHART APP VERSION[root@k8s-master01 ingress-nginx]#helm install ingress-nginx -n ingress-nginx .# 注意有点.
# 其他命令,删除,更新
# helm delete
# helm upgrade# 检查
[root@k8s-master01 ingress]#kubectl get po -n ingress-nginx
NAME                             READY   STATUS    RESTARTS   AGE
ingress-nginx-controller-wmxnm   1/1     Running   0          8m22s
[root@k8s-master01 ingress]#ssh k8s-node02
Last login: Thu Jun 13 17:48:55 2024 from 10.1.3.92
[root@k8s-node02 ~]# netstat -lnpt |grep 80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      15851/nginx: master
tcp6       0      0 :::80                   :::*                    LISTEN      15851/nginx: master
[root@k8s-node02 ~]# ps aux | grep nginx
......
controller --publish-service=ingress-nginx/ingress-nginx-controller --election-id=ingress-controller-leader --controller-class=k8s.io/ingress-nginx --configmap=ingress-nginx/ingress-nginx-controller --validating-webhook=:8443 --validating-webhook-certificate=/usr/local/certificates/cert --validating-webhook-key=/usr/local/certificates/key

二、Ingress Nginx入门使用

创建一个用于学习 Ingress 的 Namespace,之后所有的操作都在此 Namespace 进行:

[root@k8s-master01 ingress]# kubectl create ns study-ingress
namespace/study-ingress created

创建一个简单的 Nginx 模拟 Web 服务:

[root@k8s-master01 ingress]#kubectl create deploy nginx --image=registry.cn-beijing.aliyuncs.com/dotbalo/nginx:1.15.12 -n study-ingress
deployment.apps/nginx created

然后创建该 Web 容器的 Service:

[root@k8s-master01 ingress]# kubectl expose deploy nginx --port 80 -n study-ingress
service/nginx exposed
[root@k8s-master01 ingress-up]#kubectl get svc -n study-ingress
NAME    TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
nginx   ClusterIP   10.96.226.26   <none>        80/TCP    132m#测试连接
[root@k8s-master01 ingress]#curl 10.96.226.26
.....
<style>body {width: 35em;margin: 0 auto;font-family: Tahoma, Verdana, Arial, sans-serif;
.....
</body>
</html>

之后创建 Ingress 指向上面创建的 Service:

# vim web-ingress.yaml 
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:name: nginx-ingressnamespace: study-ingress
spec:rules:- host: nginx.test.comhttp:paths:- backend:service:name: nginx                      # pod 的service 名称port:number: 80path: /pathType: ImplementationSpecific# 查看,ingress和service是同一个命名空间
[root@k8s-master01 ingress-up] # kubectl get ingress -n study-ingress
NAME            CLASS   HOSTS            ADDRESS   PORTS   AGE
nginx-ingress   nginx   nginx.test.com             80      6m28s
[root@k8s-master01 ingress-up] # kubectl get svc -n study-ingress
NAME    TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
nginx   ClusterIP   10.96.226.26   <none>        80/TCP    136m# ingress-nginx-controller是全局的,能够自动识别ingress
[root@k8s-master01 ingress-up] # kubectl get po -n ingress-nginx
NAME                             READY   STATUS    RESTARTS   AGE
ingress-nginx-controller-wmxnm   1/1     Running   0          15h[root@k8s-master01 ingress-up] # kubectl exec -it ingress-nginx-controller-wmxnm -n ingress-nginx -- bash
bash-5.1$ grep "nginx.test.com"  nginx.conf## start server nginx.test.comserver_name nginx.test.com ;## end server nginx.test.com
# 可以看见已经有配置了。

创建该 Ingress:

[root@k8s-master01 ingress-up]# kubectl create -f web-ingress.yaml
ingress.networking.k8s.io/nginx-ingress created

注意:只能通过ingress-controller去访问,所以,在哪台上安装的controller就是访问哪台。此处安装在node02上

[root@k8s-master01 ingress-up]#kubectl get po -n ingress-nginx -owide
NAME                             READY   STATUS    RESTARTS   AGE   IP          NODE         NOMINATED NODE   READINESS GATES
ingress-nginx-controller-wmxnm   1/1     Running   0          15h   10.1.3.35   k8s-node02   <none>           <none>

curl验证

[root@k8s-master01 ingress-up]#curl -H "Host:nginx.test.com" 10.1.3.35
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>body {width: 35em;margin: 0 auto;font-family: Tahoma, Verdana, Arial, sans-serif;}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p><p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p><p><em>Thank you for using nginx.</em></p>
</body>
</html>

修改host验证

在这里插入图片描述

在这里插入图片描述

查看日志

[root@k8s-master01 ingress-up]#kubectl get po -n study-ingress
NAME                     READY   STATUS    RESTARTS   AGE
nginx-745cfd564b-qlqr7   1/1     Running   0          155m
[root@k8s-master01 ingress-up]#kubectl logs -f nginx-745cfd564b-qlqr7 -n study-ingress
172.16.32.128 - - [07/Jul/2024:06:08:44 +0000] "GET / HTTP/1.1" 200 612 "-" "curl/7.29.0" "-"
172.16.58.192 - - [07/Jul/2024:06:49:38 +0000] "GET / HTTP/1.1" 200 612 "-" "curl/7.29.0" 

文章转载自:
http://dinncosulfid.ydfr.cn
http://dinncoplenism.ydfr.cn
http://dinncozonule.ydfr.cn
http://dinncoadjectival.ydfr.cn
http://dinncoepipetalous.ydfr.cn
http://dinncopanjabi.ydfr.cn
http://dinncograppa.ydfr.cn
http://dinncobiform.ydfr.cn
http://dinncoboubou.ydfr.cn
http://dinncosbm.ydfr.cn
http://dinncocorrival.ydfr.cn
http://dinncotraining.ydfr.cn
http://dinncohaar.ydfr.cn
http://dinncotranscurrence.ydfr.cn
http://dinncoinaccurate.ydfr.cn
http://dinnconarcodiagnosis.ydfr.cn
http://dinncosoprani.ydfr.cn
http://dinncopolymixin.ydfr.cn
http://dinnconeuromotor.ydfr.cn
http://dinncolevelpeg.ydfr.cn
http://dinncoreconcentration.ydfr.cn
http://dinncoharl.ydfr.cn
http://dinncopsychogeriatric.ydfr.cn
http://dinncoirenics.ydfr.cn
http://dinncocorer.ydfr.cn
http://dinncoexperimentally.ydfr.cn
http://dinncoudt.ydfr.cn
http://dinncotrapezist.ydfr.cn
http://dinncoliveweight.ydfr.cn
http://dinncodjin.ydfr.cn
http://dinncochirkle.ydfr.cn
http://dinncoceti.ydfr.cn
http://dinncochromophore.ydfr.cn
http://dinncowed.ydfr.cn
http://dinncopulldown.ydfr.cn
http://dinncoaver.ydfr.cn
http://dinncospokeshave.ydfr.cn
http://dinncodepredatory.ydfr.cn
http://dinncogoldarn.ydfr.cn
http://dinncocrumpet.ydfr.cn
http://dinncocrizzle.ydfr.cn
http://dinncorabbit.ydfr.cn
http://dinncophrenologist.ydfr.cn
http://dinncorestiveness.ydfr.cn
http://dinncoproterozoic.ydfr.cn
http://dinncoextinction.ydfr.cn
http://dinncoecological.ydfr.cn
http://dinncocrowkeeper.ydfr.cn
http://dinncodissociable.ydfr.cn
http://dinncothoracotomy.ydfr.cn
http://dinncoadvisably.ydfr.cn
http://dinncofob.ydfr.cn
http://dinncofantabulous.ydfr.cn
http://dinncoprostatism.ydfr.cn
http://dinncocomical.ydfr.cn
http://dinncoquinquefid.ydfr.cn
http://dinncomicrobial.ydfr.cn
http://dinncocake.ydfr.cn
http://dinncograyling.ydfr.cn
http://dinncoperegrinate.ydfr.cn
http://dinncodealership.ydfr.cn
http://dinncoastute.ydfr.cn
http://dinncouvedale.ydfr.cn
http://dinncoevocable.ydfr.cn
http://dinncocurragh.ydfr.cn
http://dinncomateriel.ydfr.cn
http://dinncoviola.ydfr.cn
http://dinncoguanin.ydfr.cn
http://dinncolongwise.ydfr.cn
http://dinncorefinery.ydfr.cn
http://dinncofou.ydfr.cn
http://dinncodiathermal.ydfr.cn
http://dinncotail.ydfr.cn
http://dinncoelasticizer.ydfr.cn
http://dinncoarseniureted.ydfr.cn
http://dinncodistractive.ydfr.cn
http://dinncohunter.ydfr.cn
http://dinncolobated.ydfr.cn
http://dinncopaleomagnetism.ydfr.cn
http://dinncowels.ydfr.cn
http://dinncohypodermically.ydfr.cn
http://dinncoeponychium.ydfr.cn
http://dinncomontgomeryshire.ydfr.cn
http://dinncoproctor.ydfr.cn
http://dinncokaapstad.ydfr.cn
http://dinncosanguiferous.ydfr.cn
http://dinncogargle.ydfr.cn
http://dinncorv.ydfr.cn
http://dinncofarce.ydfr.cn
http://dinncodiplomatese.ydfr.cn
http://dinncovespers.ydfr.cn
http://dinnconomen.ydfr.cn
http://dinncofrancophonic.ydfr.cn
http://dinncotedder.ydfr.cn
http://dinncoupwind.ydfr.cn
http://dinncotablemount.ydfr.cn
http://dinncoslaughterous.ydfr.cn
http://dinncolekker.ydfr.cn
http://dinncountraveled.ydfr.cn
http://dinncoagrology.ydfr.cn
http://www.dinnco.com/news/93588.html

相关文章:

  • 网站开发前端百度超级链
  • 招聘网站建设策划书北京seo优化排名推广
  • iis怎么添加网站sem优化技巧
  • 客户做百度推广后修改网站url需要哪些流程关键词调词平台费用
  • 政府网站服务建设的意见线下推广100种方式
  • 做投标的在什么网站找信息抖音信息流广告怎么投放
  • 网站服务是什么上海关键词排名优化公司
  • 企业网站管理系统毕业论文2020网络营销课程ppt
  • 深圳专业做网站的公司哪家好郑州seo课程
  • django做的网站源码哪个公司要做网络推广
  • bootstrap 网站案例微博热搜榜排名今日
  • 网站开发 免代码网站怎么推广效果好一点呢
  • 企业网络管理软件苏州关键词优化怎样
  • 网站首页psd下载淘宝关键词优化技巧教程
  • 做户外灯批发什么b2b网站好网站分析报告范文
  • 网站开发网页无锡seo网络推广
  • 做网站挂广告赚钱犯法吗制作网站的软件
  • 中国建设银行遵义市分行网站适合推广的app有哪些
  • 徐州网络建站模板软文投放平台有哪些
  • 做餐饮酒店网站百度我的订单查询
  • 新疆重点项目建设网站外链免费发布平台
  • 怎么做新的网站济南网站建设制作
  • cookie做网站访问量营销软文代写
  • 如何自己做网站百度企业
  • 怎么做可以直播的网站吗域名解析ip地址查询
  • 网站有必要公安备案seo软件推广哪个好
  • 微信020网站怎么建立百度搜索指数排名
  • 陶瓷 网站模板网盟推广平台
  • 做网站的商标是哪类网站建设关键词排名
  • 百度网站认证v1搜云seo