terraform (2) 썸네일형 리스트형 (Spring Boot) - k8s java client로 k8s API와 통신하기 🍳머리말 local환경 에서 Spring boot를 이용해 k8s API와 통신하여 특정 namespace의 pod 목록을 출력하는 예제글입니다. 📕 Prerequisite 📔 k8s cluster 📔 Spring Boot 📕 k8s cluster 설정 📔 k8s cluster 내 ~/.kube/config 정보 확인 다음처럼 명령어 입력시 구축된 k8s config 내용을 확인할 수 있습니다. 해당 내용을 복붙해 config file을 만들어줍니다. 📔 특정 namespace 명에 떠 있는 pod 확인 mskim이라는 namespace에 떠 있는 pod들의 목록입니다. 📕 Spring Boot 구성 📔 project 생성 다음 사이트에서 자신이 사용하는 jdk에 맞게 적절히 생성해줍니다. 제 경우는 j.. (Terraform) - client-go로 pod에 terraform 명령 실행하기 🍳머리말 k8s 외부에서 client-go를 이용해 pod에 직접 접근해 내부 container에 있는 terraform cli를 실행해 ec2 instance를 띄우는 예제입니다. {}로 감싸진 부분은 직접 입력해야하는 부분도 있습니다. 📕Prerequisite 📔 go v1.17+ 📔 k8s cluster 📔 k8s cluster 내 ~/.kube/config 정보 📔 docker 📔 docker hub 계정 📔 aws console 계정 📔 terraform cli 📕 Terraform cli 설치 ubuntu를 base image container를 사용할 것이므로 cli를 ubuntu용으로 받아줍니다. https://www.terraform.io/downloads 📕hcl file 작성 작업 f.. 이전 1 다음