From bd36aad141e95583a69acc72334a0f4d52eac2ed Mon Sep 17 00:00:00 2001 From: Sambo Chea Date: Tue, 12 Oct 2021 18:06:25 +0700 Subject: [PATCH] Add install kube cluster script and add ingress nginx guide --- INGRESS-NGINX.md | 64 +++++++++++++++++++++ kube-cluster-install-r.sh | 117 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 181 insertions(+) create mode 100644 INGRESS-NGINX.md create mode 100644 kube-cluster-install-r.sh diff --git a/INGRESS-NGINX.md b/INGRESS-NGINX.md new file mode 100644 index 0000000..3a85663 --- /dev/null +++ b/INGRESS-NGINX.md @@ -0,0 +1,64 @@ +# Install NGINX Ingress Controller + +- Add Ingress Repository + +```shell +helm repo add cubetiq-ingress-nginx https://charts.ctdn.net/ingress-nginx +helm repo update +``` + +- Install Ingress Controller + +```shell +helm install nginx-ingress cubetiq-ingress-nginx/ingress-nginx --set controller.publishService.enabled=true +``` + +NAME: nginx-ingress +LAST DEPLOYED: Tue Oct 12 15:03:45 2021 +NAMESPACE: default +STATUS: deployed +REVISION: 1 +TEST SUITE: None +NOTES: +The ingress-nginx 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 default get services -o wide -w nginx-ingress-ingress-nginx-controller' + +An example Ingress that makes use of the controller: + +```yaml + apiVersion: networking.k8s.io/v1 + 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: + +```yaml + apiVersion: v1 + kind: Secret + metadata: + name: example-tls + namespace: foo + data: + tls.crt: + tls.key: + type: kubernetes.io/tls + ``` \ No newline at end of file diff --git a/kube-cluster-install-r.sh b/kube-cluster-install-r.sh new file mode 100644 index 0000000..0b80ae3 --- /dev/null +++ b/kube-cluster-install-r.sh @@ -0,0 +1,117 @@ +echo "Downloading kubectl..." +curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + +echo "Installing kubectl..." +sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl +chmod +x kubectl +mkdir -p ~/.local/bin/kubectl +mv ./kubectl ~/.local/bin/kubectl + +echo "Verify kubectl client version" +kubectl version --client + +echo "Downloading and install helm3..." +curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash + +echo "Setup network k8s module..." +cat <