Helm installation Nginx Ingress

In order to facilitate exposing the services in the cluster to the outside of the cluster, you need to use Ingress. Next, use Helm to deploy Nginx Ingress to Kubernetes. Nginx Ingress Controller is deployed on the edge nodes of Kubernetes.

Here, use master as the edge node, and label it with label

[[emailprotected] /]# kubectl label node master node -role.kubernetes.io/edge=
node/master labeled
[[emailprotected] /]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
master Ready edge,master 4d3h v1.15.1
slaver1 Ready 4d2h v1.15.1
slaver2 Ready 4d2h v1.15.1

installation

Install using yaml configuration file

The value file ingress-nginx.yaml of stable/nginx-ingress chart is as follows:

controller:
replicaCount: 1
hostNetwork: true
nodeSelector:
node-role.kubernetes.io/edge:''
affinity:
podAntiAffinity :
requiredDuringSchedulingIgnoredDuringExecution:
-labelSelector:
matchExpressions:
-key: app
operator: In
values:
-nginx-ingress< br /> -key: component
operator: In
values:
-controller
topologyKey: kubernetes.io/hostname
tolerations:
-key: node-role .kubernetes.io/master
operator: Exists
effect: NoSchedule
-key: node-role.kubernetes.io/master
operator: Exists
effect: PreferNoSchedule
defaultBackend:
nodeSelector:
node-role.kubernetes.io/edge:''
tolerations:
-key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
-key: node-role.kubernetes.io/master
operator: Exists
effect: PreferNoSchedule

The full version of nginx-ingress

The replicaCount of the nginx ingress controller is 1, and it will be scheduled on the edge node node1. The externalIPs of the nginx ingress controller service are not specified here, but the host network is set by hostNetwork: true to set the nginx ingress controller to use the host network.

helm repo update

helm install stable/nginx-ingress -n nginx-ingress --namespace ingress-nginx -f ingress-nginx.yaml

Specific information:

[[emailprotected] /]# helm install stable/nginx-ingress -n nginx-ingress --namespace ingress-nginx -f ingress-nginx.yaml
NAME: nginx -ingress
LAST DEPLOYED: Tue Jul 30 14:39:58 2019
NAMESPACE: ingress-nginx
STATUS: DEPLOYED

RESOURCES:
== > v1/ConfigMap
NAME DATA AGE
nginx-ingress-controller 1

==> v1/Pod(related)
NAME READY STATUS RESTARTS AGE
nginx-ingress-controller-657658b9b-sp9fx 0/1 ContainerCreating 0
nginx-ingress-default-backend-f8b68765c-kfks5 0/1 ContainerCreating 0

==> v1/Service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
nginx-ingress-controller LoadBalancer 10.109.165.210 80:32371/TCP,443:32057/TCP
nginx-ingress-default-backend ClusterIP 10.101.156.153 80/TCP < invalid>

==> v1beta1/Deployment
NAME READY UP-TO-DATE AVAILABLE AGE
nginx-ingress-controller 0/1 1 0
nginx-ingress-default-backend 0/1 1 0

==> v1beta1/PodDisruptionBudget
NAME MIN AVAILABLE MAX UNAVAILABLE ALLOWED DISRUPTIONS AGE
nginx-ingress-controller 1 N/A 0
nginx-ingress-default-backend 1 N/A 0


NOTES:
The nginx-ingress controller has been installed.
It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status by running'kubectl --namespace ingress-nginx get services -o wide -w nginx-ingress-controller'

An example Ingress that makes use of the controller:

apiVersion : extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
name: example
namespace: foo
spec:
rules:
-host: www.example.com
http:
paths:
-backend:
serviceName: exampleService
servicePort: 80
path: /
# This section is only required if TLS is to be enabled for the Ingress
tls:
-hosts:
-www.example.com
secretName: example-tls

If TLS is enabled for the Ingress, a Secret containing the certificate and key must also be provided:

apiVersion: v1
kind: Secret
metadata:
name: example-tls< br /> namespace: foo
data:
tls.crt:
tls.key:
type: kubernetes.io/tls< /pre>

Directly use command to install

helm install stable/nginx-ingress -n nginx-ingress --namespace ingress-nginx --set controller.hostNetwork= true, rbac.create=true --set controller.replicaCount=1

Output:

[[emailprotected] /]# helm install stable/nginx-ingress> -n nginx -ingress> --namespace ingress-nginx> --set controller.hostNetwork=true,rbac.create=true> --set controller.replicaCount=1
Error: release nginx-ingress failed: Deployment in version "v1beta1 "cannot be handled as a Deployment: v1beta1.Deployment.Spec: v1beta1.DeploymentSpec.Template: v1.PodTemplateSpec.Spec: v1.PodSpec.HostNetwork: ReadBool: expect t or f, but found ", error found in #10 byte of ...|Network":"true,rba|..., bigger context ...|s":{}}],"dnsPolicy":"ClusterFirst","hostNetwork":"true, rbac.create=true ","serviceAccountName":"def|...

The installation is abnormal. I did not set rbac when installing the helm here. Just remove and reinstall it.

[[emailprotected] /]# helm install stable/nginx-ingress> -n nginx- ingress> --namespace ingress-nginx> --set controller.hostNetwork=true,controller.replicaCount=1
NAME: nginx-ingress
LAST DEPLOYED: Tue Jul 30 15:19:59 2019
NAMESPACE: ingress-nginx
STATUS: DEPLOYED

RESOURCES:
==> v1/ConfigMap
NAME DATA AGE
nginx-ingress-controller 1

==> v1/Pod(related)
NAME READY STATUS RESTARTS AGE
nginx-ingress-controller-67db56c89f-2hkxq 0/1 ContainerCreating 0
nginx-ingress-default-backend-878d64884-q4fmt 0/1 ContainerCreating 0

==> v1/Service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
nginx-ingress-controller LoadBalancer 10.108.107.199 80:31412/TCP,443:31392/TCP
nginx-ingress-default-backend ClusterIP 10.107.244.59 80/TCP

== > v1beta1/Deployment
NAME READY UP-TO-DATE AVAILABLE AGE
nginx-ingress-controller 0/1 1 0
nginx-ingress-default-backend 0/1 1 0

==> v1beta1/PodDisruptionBudget
NAME MIN AVAILABLE MAX UNAVAILABLE ALLOWED DISRUPTIONS AGE
nginx-ingress-controller 1 N/A 0
nginx-ingress-default-backend 1 N/A 0


NOTES:
The nginx-ingress controller has been installed.
It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status by running'kubectl --namespace ingress-nginx get services -o wide -w nginx-ingress-controller'

An example Ingress that makes use of the controller:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
name: example
namespace: foo
spec:
rules:
-host: www.example.com
http:
paths:
-backend:
serviceName: exampleService
servicePort: 80
path: /< br /> # This section is only required if TLS is to be enabled for the Ingress
tls:
-hosts:
-www.example.com
secretName: example-tls

If TLS is enabled for the Ingress, a Secret containing the certificate and key must also be provided:

apiVersion: v1
kind: Secret
metadata:
name: example-tls
namespace: foo
data:
tls.crt:
tls.key:
type: kubernetes.io/tls

delete nginx-ingress

Deletenginx-ingress

[[emailprotected] /]# helm delete nginx-ingress
release "nginx-ingress" deleted
[ [email protected] /]# helm ls --all nginx-ingress
NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
nginx-ingress 1 Tue Jul 30 14:31:01 2019 DELETED nginx-ingress-0.9 .5 0.10.2 ingress-nginx
[[emailprotected] /]# helm delete --purge nginx-ingress
release "nginx-ingress" deleted
[[emailprotected] /] # helm ls --all nginx-ingress

Use the --purge parameter to completely delete the release without leaving a record, otherwise the release with the same name cannot be used in the next deployment.

View successful installation

View pods:

[[emailprotected] /]# kubectl get pod -n ingress-nginx -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
nginx-ingress-controller-657658b9b-sp9fx 0/1 CrashLoopBackOff 2 61s 18.16.202.163 master
nginx-ingress-default-backend-f8b68765c-kfks5 1/1 Running 0 61s 10.244.0.2 master

View services:

[[emailprotected] /]# kubectl get svc -o wide
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
broken-gorilla-nginx-ingress-controller LoadBalancer 10.111.2.40 80:31105 /TCP,443:30258/TCP 9m38s app=nginx-ingress,component=controller,release=broken-gorilla
broken-gorill a-nginx-ingress-default-backend ClusterIP 10.103.239.117 80/TCP 9m38s app=nginx-ingress,component=default-backend,release=broken-gorilla
kubernetes ClusterIP 10.96.0.1 443 /TCP 4d4h

helm view:

[[emailprotected] /]# helm ls --all nginx-ingress
NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
nginx-ingress 1 Tue Jul 30 14:39:58 2019 DEPLOYED nginx-ingress-0.9.5 0.10.2 ingress-nginx

reference:

Use kubeadm to install Kubernetes 1.15

Use Helm to install Nginx ingress

Use Helm to quickly deploy Ingress

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 480 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.