In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "how to install and deploy Nginx-ingress". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to install and deploy Nginx-ingress.
1. Overview
In this article we introduce how to install and deploy Nginx-ingress. Only after accumulating experience with different components can we better compare its advantages and disadvantages and form best practices.
2. Installation and deployment of nginx-ingress components 2.1 find nginx-ingress# step1 through helm: find nginx-ingress > helm search nginx-ingress > helm inspect stable/nginx-ingress2.2 image download and upload through helm
Some enterprises cannot obtain foreign Docker images because their servers do not have wai network access policies and firewalls, so we need to prepare the required images in advance and upload them to the enterprise private image warehouse.
# step2: image preparation > docker pull quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.25.1 > docker tag quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.25.1 registry.hankercloud.com/ingress-controller/nginx-ingress-controller:0.25.1 > docker push registry.hankercloud.com/ingress-controller/nginx-ingress-controller:0.25.1 > > docker pull k8s.gcr.io/defaultbackend-amd64:1.5 > docker tag k8s.gcr .io/defaultbackend-amd64:1.5 registry.hankercloud.com/google_containers/defaultbackend-amd64:1.5 > docker push registry.hankercloud.com/google_containers/defaultbackend-amd64:1.52.3 component deployment
In the previous blog, we deployed the traefik component using the Deployment model, and this time we used the DaemonSet pattern to deploy the nginx-ingress component
# step3: component deployment > helm install stable/nginx-ingress-- name nginx-ingress--namespace=kube-system\-- set fullnameOverride=nginx-ingress\-- set controller.kind=DaemonSet\-- set controller.daemonset.useHostPort=true\-- set controller.metrics.enabled=true\-- set controller.image.repository=registry.hankercloud.com/ingress-controller/nginx-ingress-controller\-- set defaultBackend.image.repository=registry.hankercloud.com/google_containers/defaultbackend-amd64# step4: check Check whether the deployment is successful > helm list > kubectl get all-n kube-system > kubectl logs $POD_NAME-n kube-system2.4 load balance configuration and domain name resolution processing
This time, we use DaemonSet to deploy nginx-ingress components, and use the host's interfaces 80 and 443 to receive http and https requests, respectively. After we resolve the corresponding domain name to the host IP where the nginx-ingress Pod is located, we can access the corresponding domain name through the domain name.
However, the above configuration method cannot achieve high availability. When the Pod instance of nginx-ingress fails or its host fails, the corresponding domain name will be inaccessible. Therefore, it is recommended to purchase load balancer devices in the public cloud and configure the corresponding backend server list to achieve high availability.
2.5 installation and debugging
In the above, we deployed a wordpress application through helm. In this article, we continue to access the domain name through this application. Enter > curl-I http://10.0.0.182-H 'Host: blog.hankercloud.com', in the local console. If you see a normal return, the deployment is successful.
3. Enterprise scenario and solution 3.1 how to isolate internal and external networks
Step1: we first deployed two ingress components, one of which is to receive private network access requests and the other is to receive wai network access requests. The corresponding configuration is as follows:
# Private network nginx-ingress configuration statement: spec: template: spec: containers:-args:-/ nginx-ingress-controller-default-backend-service=kube-system/nginx-ingress-default-backend-election-id=ingress-controller-leader-- ingress-class=nginx-configmap=kube-system/nginx-ingress-controller# public network nginx-ingress configuration sound Ming: spec: template: spec: containers:-args:-/ nginx-ingress-controller-default-backend-service=kube-system/nginx-ingress-external-default-backend-election-id=ingress-controller-leader-ingress-class=nginx-external-configmap=kube-system/nginx-ingress-external-controller
The main difference between the two is the parameter-- the value set by ingress-class is not the same.
Step2: modify the definition of ingress for domain names that need to be exposed to the public network. The corresponding configuration is as follows:
Metadata: name: www annotations: kubernetes.io/ingress.class: "nginx-external"
Step3: check whether the configuration is successful, and execute kubectl exec ${POD_NAME}-n kube-system cat / etc/nginx/nginx.conf to check whether there are packages in the configuration file.
At this point, I believe you have a deeper understanding of "how to install and deploy Nginx-ingress". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.