From 52dcab26212cd7adb078df06726b201dd9ecd795 Mon Sep 17 00:00:00 2001 From: James Pace Date: Mon, 29 Aug 2022 18:46:10 -0400 Subject: [PATCH] Initial succesfull trigger from zuul comment. --- ambassador/listener.yaml | 22 --------- ambassador/mapping.yaml | 7 --- dns/dns.yaml | 28 ++++++++++++ notes.md | 91 +++++++++++++++++++++++-------------- triggers/eventlistener.yaml | 5 +- triggers/ingress.yaml | 18 ++++++++ 6 files changed, 106 insertions(+), 65 deletions(-) delete mode 100644 ambassador/listener.yaml delete mode 100644 ambassador/mapping.yaml create mode 100644 dns/dns.yaml create mode 100644 triggers/ingress.yaml diff --git a/ambassador/listener.yaml b/ambassador/listener.yaml deleted file mode 100644 index 1ef59cb..0000000 --- a/ambassador/listener.yaml +++ /dev/null @@ -1,22 +0,0 @@ ---- -apiVersion: getambassador.io/v3alpha1 -kind: Host -metadata: - name: tekton-host -spec: - hostname: "tekton.internal.jpace121.net" - requestPolicy: - insecure: - action: Route ---- -apiVersion: getambassador.io/v3alpha1 -kind: Listener -metadata: - name: http-listener -spec: - port: 8080 - protocol: HTTP - securityModel: INSECURE - hostBinding: - namespace: - from: SELF \ No newline at end of file diff --git a/ambassador/mapping.yaml b/ambassador/mapping.yaml deleted file mode 100644 index 8103b8a..0000000 --- a/ambassador/mapping.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: getambassador.io/v3alpha1 -kind: Mapping -metadata: - name: test-listener-mapping -spec: - prefix: /test-event/ - service: el-test-listener.default.svc.cluster.local:8080 \ No newline at end of file diff --git a/dns/dns.yaml b/dns/dns.yaml new file mode 100644 index 0000000..ca5669c --- /dev/null +++ b/dns/dns.yaml @@ -0,0 +1,28 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: coredns + namespace: kube-system +data: + Corefile: | + .:53 { + errors + health + hosts { + 192.168.1.138 gerrit.internal.jpace121.net + 192.168.1.128 k3s + fallthrough + } + ready + kubernetes cluster.local in-addr.arpa ip6.arpa { + pods insecure + fallthrough in-addr.arpa ip6.arpa + } + prometheus :9153 + forward . /etc/resolv.conf + cache 30 + reload + loadbalance + } + NodeHosts: | + #192.168.1.128 k3s \ No newline at end of file diff --git a/notes.md b/notes.md index 14636e4..a22c873 100644 --- a/notes.md +++ b/notes.md @@ -5,54 +5,46 @@ Install: 1. Set up wireguard. 2. Download k3s install script from website. 3. For master: - `INSTALL_K3S_EXEC="server --node-ip '10.100.100.5' --advertise-address '10.100.100.5' --flannel-iface 'wg0'" ./k3s.sh` + `./k3s.sh` 4. For node: - `INSTALL_K3S_EXEC="agent --server 'https://10.100.100.5:6443' --token 'K3S_TOKEN' --node-ip '10.100.100.?' --advertise-address '10.100.100.?' --flannel-iface 'wg0'" ./k3s.sh` + `curl -sfL https://get.k3s.io | K3S_URL=https://myserver:6443 K3S_TOKEN=mynodetoken sh -` + "The value to use for K3S_TOKEN is stored at /var/lib/rancher/k3s/server/node-token" 5. Install kubectl on laptop. 6. Copy `/etc/rancher/k3s/k3s.yaml` to laptop and change localhost IP to wireguard IP. 7. `kubectl cluster-info` 8. Install tkn CLI. `https://tekton.dev/docs/cli/` I installed manually. +4. Apply dns updates and rollout restart of codedns: + `kubectl rollout restart -n kube-system deployment/coredns` -Set up Tekton: +Install Tekton: ``` kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml -``` -Set up Tekton Dashboard: -``` -kubectl apply --filename https://storage.googleapis.com/tekton-releases/dashboard/latest/tekton-dashboard-release.yaml -``` -Port forward locally: -``` -kubectl port-forward -n tekton-pipelines service/tekton-dashboard 9097:9097 -``` - -Set up a namespace: -``` -kubectl create -f j7s-dev-namspace.json -``` -``` -kubectl config set-context j7s-dev --namespace=j7s-dev \ - --cluster=j7s-dev \ - --user=default -``` -I'm not sure the above command works... - -Stuff I installed from tkn. -``` -tkn hub install task git-clone -tkn hub install task ansible-runner -tkn hub install task git-batch-merge -``` - -Triggers: - -Install: - kubectl apply --filename https://storage.googleapis.com/tekton-releases/triggers/latest/release.yaml kubectl apply --filename https://storage.googleapis.com/tekton-releases/triggers/latest/interceptors.yaml +``` +Set up local registry on master. +(I didn't document this process.) +Tell k3s about it: +```sudo vim /etc/rancher/k3s/registries.yaml``` +``` +configs: + "192.168.1.128:8443": + auth: + username: k3s + password: password + tls: + ca_file: /home/jimmy/registry/certs/domain.crt + +``` +Restart k3s. + +Apply rest of the CRDs. + + +# Bad Ideas Amabassador: (for knative) @@ -69,3 +61,32 @@ I'm not sure why ambassdor is listening on 80 instead of 8080 given the settings I applied, or why changing from 8080 to 80 in the seeting borks it. +I removed amabassador andput back traefik. + + +Set up Tekton Dashboard: +``` +kubectl apply --filename https://storage.googleapis.com/tekton-releases/dashboard/latest/tekton-dashboard-release.yaml +``` +Port forward locally: +``` +kubectl port-forward -n tekton-pipelines service/tekton-dashboard 9097:9097 +``` + +If we later want to do this on an overlay network: +3. For master: + `INSTALL_K3S_EXEC="server --node-ip '10.100.100.5' --advertise-address '10.100.100.5' --flannel-iface 'wg0'" ./k3s.sh` +4. For node: + `INSTALL_K3S_EXEC="agent --server 'https://10.100.100.5:6443' --token 'K3S_TOKEN' --node-ip '10.100.100.?' --advertise-address '10.100.100.?' --flannel-iface 'wg0'" ./k3s.sh` +For now sticking to single node... + +Set up a namespace: +``` +kubectl create -f j7s-dev-namspace.json +``` +``` +kubectl config set-context j7s-dev --namespace=j7s-dev \ + --cluster=j7s-dev \ + --user=default +``` +I'm not sure the above command works... diff --git a/triggers/eventlistener.yaml b/triggers/eventlistener.yaml index 58cb6a1..ff6a2cf 100644 --- a/triggers/eventlistener.yaml +++ b/triggers/eventlistener.yaml @@ -11,6 +11,9 @@ spec: - ref: message-binding template: ref: pipeline-template + resources: + kubernetesResource: + serviceType: NodePort --- apiVersion: triggers.tekton.dev/v1beta1 kind: TriggerBinding @@ -28,7 +31,7 @@ metadata: spec: params: - name: gitrepositoryurl - value: ssh://gerrit.internal.jpace121.net:29418/ci/test + value: ssh://tekton@gerrit.internal.jpace121.net:29418/ci/test --- apiVersion: triggers.tekton.dev/v1beta1 diff --git a/triggers/ingress.yaml b/triggers/ingress.yaml new file mode 100644 index 0000000..9cce865 --- /dev/null +++ b/triggers/ingress.yaml @@ -0,0 +1,18 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: git-tekton-ingress + annotations: + nginx.ingress.kubernetes.io/rewrite-target: / +spec: + rules: + - host: tekton.internal.jpace121.net + http: + paths: + - path: /test-events/ + pathType: Prefix + backend: + service: + name: el-test-listener + port: + number: 8080 \ No newline at end of file