diff --git a/playbook/roles/k3s/files/setup-dns-provider.sh b/playbook/roles/k3s/files/setup-dns-provider.sh index 7aa484a0..fd95c62c 100644 --- a/playbook/roles/k3s/files/setup-dns-provider.sh +++ b/playbook/roles/k3s/files/setup-dns-provider.sh @@ -20,7 +20,7 @@ alibabacloud: EOF export KUBECONFIG=/etc/rancher/k3s/k3s.yaml -helm repo add bitnami https://charts.bitnami.com/bitnami -helm repo update -kubectl create namespace external-dns -helm upgrade --install external-dns -f external-dns-values.yaml bitnami/external-dns -n external-dns +sudo helm repo add bitnami https://charts.bitnami.com/bitnami || echo true +sudo helm repo update +sudo kubectl create namespace external-dns || echo true +sudo helm upgrade --install external-dns -f external-dns-values.yaml bitnami/external-dns -n external-dns diff --git a/playbook/roles/k3s/files/setup-ingress-with-nodePort.sh b/playbook/roles/k3s/files/setup-ingress-with-nodePort.sh index 39f3f840..caf30111 100644 --- a/playbook/roles/k3s/files/setup-ingress-with-nodePort.sh +++ b/playbook/roles/k3s/files/setup-ingress-with-nodePort.sh @@ -1,10 +1,6 @@ #!/bin/bash ip=$1 -helm repo add nginx-stable https://helm.nginx.com/stable -helm repo up - -kubectl create namespace ingress cat > value.yaml < nginx-cm.yaml << EOF apiVersion: v1 @@ -31,7 +26,6 @@ data: proxy-read-timeout: 10s EOF - cat > nginx-svc-patch.yaml << EOF spec: ports: @@ -47,37 +41,9 @@ spec: targetPort: 443 EOF -kubectl apply -f nginx-cm.yaml -kubectl patch svc nginx-nginx-ingress -n ingress --patch-file nginx-svc-patch.yaml - -cat > tcp-service-crd.yaml << EOF -apiVersion: k8s.nginx.org/v1alpha1 -kind: GlobalConfiguration -metadata: - name: nginx-configuration - namespace: ingress -spec: - listeners: - - name: gitlab-tcp - port: 22 - protocol: TCP ---- -apiVersion: k8s.nginx.org/v1alpha1 -kind: TransportServer -metadata: - name: gitlab-tcp-proxy - namespace: gitlab -spec: - listener: - name: gitlab-tcp - protocol: TCP - upstreams: - - name: gitlab-shell-svc - service: gitlab-gitlab-shell - port: 22 - action: - pass: gitlab-shell-svc -EOF -kubectl apply -f tcp-service-crd.yaml -# -# https://www.nginx.com/blog/load-balancing-tcp-and-udp-traffic-in-kubernetes-with-nginx/ +sudo helm repo add nginx-stable https://helm.nginx.com/stable || echo true +sudo helm repo up +sudo kubectl create namespace ingress || echo true +sudo helm upgrade --install nginx nginx-stable/nginx-ingress --version=0.15.0 --namespace ingress -f value.yaml +sudo kubectl apply -f nginx-cm.yaml +sudo kubectl patch svc nginx-nginx-ingress -n ingress --patch-file nginx-svc-patch.yaml diff --git a/playbook/roles/k3s/files/setup-k3s-with-hostpath-sc.sh b/playbook/roles/k3s/files/setup-k3s-with-hostpath-sc.sh index 3423b62a..42d28fac 100644 --- a/playbook/roles/k3s/files/setup-k3s-with-hostpath-sc.sh +++ b/playbook/roles/k3s/files/setup-k3s-with-hostpath-sc.sh @@ -9,5 +9,5 @@ curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.24.7+k3s1 sh -s - \ #export KUBECONFIG=/etc/rancher/k3s/k3s.yaml sudo wget --no-check-certificate https://mirrors.onwalk.net/tools/linux-amd64/helm.tar.gz && sudo tar -xvpf helm.tar.gz -C /usr/local/bin/ sudo chmod 755 /usr/local/bin/helm -helm repo add artifact https://artifact.onwalk.net/chartrepo/k8s/ -helm repo up +sudo helm repo add artifact https://artifact.onwalk.net/chartrepo/k8s/ | echo true +sudo helm repo up