8.2.3 앰배서더 컨테이너를 이용한 API 서버 통신 간소화
앰베서더 컨테이너 패턴

- API 서버와 직접 통신하는 대신 메인 컨테이너의 애플리케이션은 https 대신 http로 앰베서더에 연결
- 앰베서더 프록시가 api 서버에 대한 https 연결 처리 < 시크릿 볼륨에 있는 default-token 파일 사용해 수행
https://github.com/luksa/kubernetes-in-action/blob/master/Chapter08/curl-with-ambassador.yaml
kubernetes-in-action/Chapter08/curl-with-ambassador.yaml at master · luksa/kubernetes-in-action
Code from the Kubernetes in Action book. Contribute to luksa/kubernetes-in-action development by creating an account on GitHub.
github.com
apiVersion: v1
kind: Pod
metadata:
name: curl-with-ambassador
spec:
containers:
- name: main
image: tutum/curl
command: ["sleep", "9999999"]
- name: ambassador
image: luksa/kubectl-proxy:1.6.2
인증 토큰 및 서버 인증서 처리할 필요 없이 바로 접근 가능

- curl은 일반 http 요청을 앰베서더 컨테이너 내에서 실행중인 프록시로 전송한 다음
- 프록시는 https 요청을 api 서버로 전송
- 프록시는 토큰을 전송해 크라이언트 인증을 처리하고 서버의 인증서를 검증해 서버의 신원을 파악함
8.2.4 클라이언트 라이브러리를 사용해 api 서버와 통신
https://kubernetes.io/docs/reference/using-api/client-libraries/
Client Libraries
This page contains an overview of the client libraries for using the Kubernetes API from various programming languages. To write applications using the Kubernetes REST API, you do not need to implement the API calls and request/response types yourself. You
kubernetes.io
'스터디 > [쿠버네티스 인 액션] (2024.8)' 카테고리의 다른 글
[쿠버네티스 인 액션] 9장. 디플로이먼트 : 선언적 애플리케이션 업데이트 - 디플로이먼트 (2) | 2024.10.20 |
---|---|
[쿠버네티스 인 액션] 9장. 디플로이먼트 : 선언적 애플리케이션 업데이트 - 롤링업데이트 (0) | 2024.10.19 |
[쿠버네티스 인 액션] 8장. 애플리케이션 파드 메타데이터와 그 외의 리소스에 엑세스하기 (6) | 2024.10.09 |
[쿠버네티스 인 액션] 7장. 컨피그맵과 시크릿 - 컨피그맵, 시크릿 + 참고영상 (0) | 2024.10.03 |
[쿠버네티스 인 액션] 7장. 컨피그맵과 시크릿 - 컨테이너에 명령어 인수 전달, 각 컨테이너에 사용자 정의 환경변수 지정 (0) | 2024.10.02 |