kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml
- WEB에 올라와있는 매니페스트 파일을 통해 클러스터에 배포하자. 버전은 최신 버전을 설치한다
- TEKTON Pipeline을 설치하면, TEKTON의 커스텀 리소스들을 사용할 수 있다
[ec2-user@ip-100-0-1-19 hongwork]$ k get pods -n tekton-pipelines
NAME READY STATUS RESTARTS AGE
tekton-pipelines-controller-6b8858b466-59chh 1/1 Running 0 4m51s
tekton-pipelines-webhook-85cc65d8b4-gngkk 1/1 Running 0 4m50s
- 파이프라인 컨트롤러와 웹 훅이 배포됬다. TEKTON의 주요 컴포넌트들은 tekton-pipelines 네임스페이스에 배포된다
- 컨트롤러에 대한 상세 정보는 아래 controller.yaml 내용을 확인하자
https://github.com/tektoncd/pipeline/blob/release-v0.46.x/config/controller.yaml
sudo rpm -Uvh https://github.com/tektoncd/cli/releases/download/v0.30.1/tektoncd-cli-0.30.1_Linux-64bit.rpm
- TEKTON CLI를 rpm 파일을 통해 설치하자
- rpm은 yum 으로 설치하기 어렵거나, yum 저장소에 등록되어 있지 않는 프로그램들을 설치하고자 할 때, rpm 파일을 다운 받아 패키지를 설치 및 업데이트 한다
- U 는 업그레이드, v는 설치 시 상세 내용 출력, h는 설치 시 progress를 #으로 표시해주는 옵션이다
- U를 사용하면, 기존에 설치된 패키지가 없는 경우에도 설치해준다. 또한, 기존에 설치된 패키지의 버전보다 낮은 버전의 패키지를 설치할 수 있다 ( 다운 그레이드 가능 )
[ec2-user@ip-100-0-1-19 hongwork]$ tkn version
Client version: 0.30.1
Pipeline version: v0.46.0
Dashboard version: v0.34.0
- 잘 설치되었는지 확인하자
[ec2-user@ip-100-0-1-19 hongwork]$ tkn task list
No Tasks found
- Task 리스트를 조회하면, 현재 생성된 Task가 없다고 출력된다
- TEKTON CLI ( TKN ) 명령어를 사용하면, 명령이 API로 변환되어 Kubeconfig 정보를 가지고 Kube Api Server에 보내진다
kubectl apply --filename https://storage.googleapis.com/tekton-releases/dashboard/latest/release-full.yaml
- 최신 버전을 배포하자
- 만약 특정 버전을 설치하고자 할 경우, 호환되는 Tekton Pipeline 버전을 확인해야 한다
- relase.yaml을 통해 설치하면 read-only이다
- relase-full.yaml을 통해 설치하면 read / write 가 가능하다
- 설치할 버전은 아래 링크에서 확인하자
https://github.com/tektoncd/triggers/releases
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
- TEKTON Trigger와 Interceptors를 배포하자
[ec2-user@ip-100-0-1-19 hongwork]$ k get pod -n tekton-pipelines
NAME READY STATUS RESTARTS AGE
tekton-dashboard-85f55848fc-t5brl 1/1 Running 0 3h42m
tekton-pipelines-controller-6b8858b466-59chh 1/1 Running 0 6h17m
tekton-pipelines-webhook-85cc65d8b4-gngkk 1/1 Running 0 6h17m
tekton-triggers-controller-6ffc4fd54-qmpw4 1/1 Running 0 2m13s
tekton-triggers-core-interceptors-ffc68485-5pgvz 1/1 Running 0 2m13s
tekton-triggers-webhook-7db9658664-h44vj 1/1 Running 0 2m13s
- 잘 설치되었다
[ec2-user@ip-100-0-1-19 trigger]$ k get all -n tekton-pipelines
NAME READY STATUS RESTARTS AGE
pod/tekton-dashboard-85f55848fc-t5brl 1/1 Running 0 9d
pod/tekton-pipelines-controller-6b8858b466-59chh 1/1 Running 0 10d
pod/tekton-pipelines-webhook-85cc65d8b4-gngkk 1/1 Running 0 10d
pod/tekton-triggers-controller-6ffc4fd54-qmpw4 1/1 Running 0 9d
pod/tekton-triggers-core-interceptors-ffc68485-5pgvz 1/1 Running 0 5m29s
pod/tekton-triggers-webhook-7db9658664-h44vj 1/1 Running 0 9d
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/tekton-dashboard ClusterIP 10.100.59.101 <none> 9097/TCP 9d
service/tekton-pipelines-controller ClusterIP 10.100.179.247 <none> 9090/TCP,8008/TCP,8080/TCP 10d
service/tekton-pipelines-webhook ClusterIP 10.100.240.32 <none> 9090/TCP,8008/TCP,443/TCP,8080/TCP 10d
service/tekton-triggers-controller ClusterIP 10.100.90.43 <none> 9000/TCP 9d
service/tekton-triggers-core-interceptors ClusterIP 10.100.178.247 <none> 8443/TCP 5m29s
service/tekton-triggers-webhook ClusterIP 10.100.128.57 <none> 443/TCP 9d
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/tekton-dashboard 1/1 1 1 9d
deployment.apps/tekton-pipelines-controller 1/1 1 1 10d
deployment.apps/tekton-pipelines-webhook 1/1 1 1 10d
deployment.apps/tekton-triggers-controller 1/1 1 1 9d
deployment.apps/tekton-triggers-core-interceptors 1/1 1 1 5m29s
deployment.apps/tekton-triggers-webhook 1/1 1 1 9d
NAME DESIRED CURRENT READY AGE
replicaset.apps/tekton-dashboard-85f55848fc 1 1 1 9d
replicaset.apps/tekton-pipelines-controller-6b8858b466 1 1 1 10d
replicaset.apps/tekton-pipelines-webhook-85cc65d8b4 1 1 1 10d
replicaset.apps/tekton-triggers-controller-6ffc4fd54 1 1 1 9d
replicaset.apps/tekton-triggers-core-interceptors-ffc68485 1 1 1 5m29s
replicaset.apps/tekton-triggers-webhook-7db9658664 1 1 1 9d
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
horizontalpodautoscaler.autoscaling/tekton-pipelines-webhook Deployment/tekton-pipelines-webhook <unknown>/100% 1 5 1 10d
- Dashboard, Pipelines, Trigger 구성 요소가 잘 배포됬는지 확인하자
- 우리는 EKS 위에 설치를 했으니, Ingress를 통해 접속할 것이다. EKS 상에서 Nginx Ingress 설치 및 설정은 아래 링크를 참고하자
- https://velog.io/@lijahong/0%EB%B6%80%ED%84%B0-%EC%8B%9C%EC%9E%91%ED%95%98%EB%8A%94-AWS-%EA%B3%B5%EB%B6%80-EKS-%ED%99%9C%EC%9A%A9%ED%95%98%EA%B8%B0-Nginx-Ingress-%EC%84%A4%EC%B9%98-%EB%B0%8F-%ED%99%9C%EC%9A%A9
- 해당 방식을 사용하는 이유는 ingress-nginx-controller LB에 Ingress의 Host 주소를 DNS 주소로 할당하지 않았기 때문이다
- 따라서 로컬 서버의 Hosts 파일에 ingress-nginx-controller LB의 Ip 주소를 입력하여, Ingress Host 주소로 접속하면 ingress-nginx-controller LB로 트래픽이 향하도록 설정해야 한다
[ec2-user@ip-100-0-1-19 hongwork]$ k get svc -n tekton-pipelines
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
tekton-dashboard ClusterIP 10.100.143.48 <none> 9097/TCP 29m
tekton-pipelines-controller ClusterIP 10.100.179.247 <none> 9090/TCP,8008/TCP,8080/TCP 39m
tekton-pipelines-webhook ClusterIP 10.100.240.32 <none> 9090/TCP,8008/TCP,443/TCP,8080/TCP 39m
- DashBoard의 svc 이름을 확인하자
nslookup < ingress-nginx-controller LB DNS 주소 >
- ingress-nginx-controller LB의 IP 주소를 확인하자
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: tekton-dashboard
namespace: tekton-pipelines
spec:
ingressClassName: nginx # Ingress Controller 지정
rules:
- host: tekton.mandu.com # HOST 주소
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: tekton-dashboard # TEKTON DASHBOARD SVC 이름
port:
number: 9097
- Ingress 를 배포하자. host 부분에 접속할 Dns 주소를 설정하자
- 메모장을 관리자 권한으로 열자
# C:\Windows\System32\drivers\etc < ingress-nginx-controller LB IP 주소 > tekton.mandu.com
- C:\Windows\System32\drivers\etc 경로의 hosts 파일을 열고, 위 부분을 추가하자. tekton.mandu.com 이라는 DNS 주소에 대해 ingress-nginx-controller LB를 찾아가도록 설정하면 된다
- 잘 접속된다!!!
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: tekton-dashboard namespace: tekton-pipelines spec: ingressClassName: nginx # Ingress Controller 지정 rules: - host: tekton.mandu.com # HOST 주소 http: paths: - path: / pathType: Prefix backend: service: name: tekton-dashboard # TEKTON DASHBOARD SVC 이름 port: number: 9097 tls: - hosts: - tekton.mandu.com secretName: secret-tls
- 외부에서 Tekton DashBoard에 접속할 때, 가장 먼저 Ingress Controller LB에 접근하므로, Ingress에 TLS 인증서를 설정해줘야 한다
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: tekton-dashboard
namespace: tekton-pipelines
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /$2
nginx.ingress.kubernetes.io/configuration-snippet: |
rewrite ^(/[a-z1-9\-]*)$ $1/ redirect;
spec:
rules:
- http:
paths:
- path: /tekton(/|$)(.*)
pathType: Prefix
backend:
service:
name: tekton-dashboard
port:
number: 9097
- Ingress를 배포하자
kubernetes.io/ingress.class: nginx
- 적용할 Ingress Conroller 종류로 nginx를 지정
nginx.ingress.kubernetes.io/rewrite-target: /$2
- rewrite-target : Ingress에 정의된 경로로 들어오는 요청을 rewrite-target에 설정된 경로로 대체되어 서비스에게 요청. 이를 통해 서비스를 구분하는 경로는 냅두고, 하위 경로만 서비스에 요청할 수 있다
- $2로 설정했으므로 path에서 2번째 그룹인 (.*)에 해당 하는 경로만 서비스에 요청
- 만약 $1으로 한다면 서비스에 /tekton/index.html로 요청이 가지만, $2로 하면 서비스에 /index.html로 요청이 간다
- path: /tekton(/|$)(.*)
- (/|$)은 tekton/로 끝나거나 tekton으로 끝나거나를 의미한다 ( 정규 표현식 )
- .*은 길이에 상관 없는 임의의 문자열
- ( ) 로 둘러싼 부분은 하나의 덩어리로 취급한다
nginx.ingress.kubernetes.io/configuration-snippet: |
rewrite ^(/[a-z1-9\-]*)$ $1/ redirect;
- configuration-snippet : Nginx redirect / rewrite 설정 옵션
- redirect는 보통 http로의 접속을 https로 재접속하도록 사용한다
- 우리는 < nlb 주소 >/tekton으로 접속하기에, 앞에 LB DNS 주소 부분을 뒤에 $1 부분으로 재접속하게 설정하는 것이다
- < Ingress Controller LB의 기본 DNS 주소 >/tekton으로 접속해보자. 잘 접속된다!