나이는 지구가 태양을 도는 횟수일 뿐이다.
AWX 설치하기 본문
안녕하세요
처음으로 글을 써봅니다. ( 글을 잘쓰는 재주는 없는것같네요..)
앤서블 을 써본적은 없고 구글링중 awx라는 오픈소스를 알게되어 설치하고 실제 사용도 해볼예정입니다.
설치순서로는
1. K3s
2. Awx 설치
가 되겠습니다.
K3s 는 해당 블로그를 통해 MetalLB 까지 구성했습니다. (metalLB 는 L2 ip-pool 구성 사용)
https://www.fullstaq.com/knowledge-hub/blogs/setting-up-your-own-k3s-home-cluster
Setting up your own K3S home cluster
In this blog Bas shares a straightforward way to set up your K3S home cluster. Read about his experiences and the how-to guide for your own Kubernetes cluster at home.
www.fullstaq.com
Helm 설치
https://helm.sh/docs/intro/install/#from-script
Installing Helm
Learn how to install and get running with Helm.
helm.sh
Awx 설치
AWX 설치 내용중에 18버전 부터는 awx-operator 를 사용하는 방법이 기본이라고 하여 안내 된대로 진행하였습니다.
k3s도 준비되었으니 깃허브 보면서 바로 진행하겠습니다.
https://github.com/ansible/awx/blob/devel/INSTALL.md#the-awx-operator
GitHub - ansible/awx: AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of t
AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform. - GitHub - ansible/awx: AWX p...
github.com
시작!
$ helm repo add awx-operator https://ansible.github.io/awx-operator/
"awx-operator" has been added to your repositories
$ helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "awx-operator" chart repository
Update Complete. ⎈Happy Helming!⎈
$ helm pull awx-operator/awx-operator
$ ls
awx-operator-1.1.2.tgz
$ tar zxvf awx-operator-1.1.2.tgz
$ cd awx-operator
$ tree
.
├── Chart.yaml
├── crds
│ ├── customresourcedefinition-awxbackups.awx.ansible.com.yaml
│ ├── customresourcedefinition-awxrestores.awx.ansible.com.yaml
│ └── customresourcedefinition-awxs.awx.ansible.com.yaml
├── README.md
├── templates
│ ├── awx-deploy.yaml
│ ├── clusterrole-awx-operator-metrics-reader.yaml
│ ├── clusterrole-awx-operator-proxy-role.yaml
│ ├── clusterrolebinding-awx-operator-proxy-rolebinding.yaml
│ ├── configmap-awx-operator-awx-manager-config.yaml
│ ├── deployment-awx-operator-controller-manager.yaml
│ ├── _helpers.tpl
│ ├── NOTES.txt
│ ├── postgres-config.yaml
│ ├── role-awx-operator-awx-manager-role.yaml
│ ├── role-awx-operator-leader-election-role.yaml
│ ├── rolebinding-awx-operator-awx-manager-rolebinding.yaml
│ ├── rolebinding-awx-operator-leader-election-rolebinding.yaml
│ ├── serviceaccount-awx-operator-controller-manager.yaml
│ └── service-awx-operator-controller-manager-metrics-service.yaml
└── values.yaml
2. admin 암호의 비밀을 생성하고 awx에서 지정한 사용자정의 리소스로 서버에 필요한 내용을 만들어줄것입니다.
$ cd templates
$ vi adminpassword.yaml
---
apiVersion: v1
kind: Secret
metadata:
name: MYSECRET ## 원하는 이름을 입력하세요 - 기억 필수
namespace: {{ $.Release.Namespace }}
stringData:
password: MYPASSWORD ## 원하는 암호를 입력하세요
---
$ cd ..
$ pwd
/awx-operator
$ vi awx.yaml
---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
name: wp-awx
namespace: awx
spec:
admin_user: admin ## 어드민 이름
admin_password_secret: MYSECRET ## 어드민 암호 비밀의 메타데이터 이름
service_type: LoadBalancer ## MetalLB까지 구성되었으면 큰 문제없을것으로 생각됩니다.
loadbalancer_port: 80
security_context_settings:
runAsGroup: 0
runAsUser: 0
fsGroup: 0
fsGroupChangePolicy: OnRootMismatch
postgres_storage_requirements:
requests:
storage: 100Gi ## postgreSQL 용량
---
3. 배포 하기
$ pwd
/awx-operator
$ kubectl create ns awx ## awx 네임스페이스 생성
$ helm install awx-operator -f values.yaml . -n awx ## 변수 파일 지정하고 awx 네임스페이스에 설치
$ kubectl get po -n awx ## 네임스페이스에 오퍼레이터 컨테이너가 구동중인지 확인
NAME READY STATUS RESTARTS AGE
awx-operator-controller-manager-dfc4ffd5f-bxxt8 2/2 Running 0 108m
$ kubectl apply -f awx.yaml ## 만들어놓은 사용자 정의 리소스 메니페스트 배포 잠시 기다리면 확인가능합니다.
$ kubectl get po -n awx
NAME READY STATUS RESTARTS AGE
awx-operator-controller-manager-dfc4ffd5f-bxxt8 2/2 Running 0 108m
wp-awx-postgres-13-0 1/1 Running 0 104m
wp-awx-64f56d49b5-6tbtx 4/4 Running 0 100m
## 전부 running 상태 확인
$ kubectl get svc -n awx ## 외부노출된 ip 확인
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
awx-operator-controller-manager-metrics-service ClusterIP 10.43.101.225 <none> 8443/TCP 110m
wp-awx-postgres-13 ClusterIP None <none> 5432/TCP 107m
wp-awx-service LoadBalancer 10.43.143.93 172.16.1.5 80:31198/TCP 107m
## ip는 172.16.1.5 로 확인되었습니다.
4. 확인된 ip로 접속하기
메타데이터에서 입력했던 admin_user와 암호 비밀값 을 넣어 접속해봅시다.
아주 접속이 잘되는군요.
왼쪽에 리스트보니 공식문서 확인하면서 할생각하니 벌써 대뇌의 전두엽이 아파옵니다..
다음에는 AWX로 ansible 플레이북을 돌려보고 작성을 하겠습니다.
감사합니다.
'IT' 카테고리의 다른 글
[Helm]Subchart에 오픈소스 chart 추가하기 (0) | 2023.03.22 |
---|---|
GKE에서 ECR 이미지 사용하기 (0) | 2023.02.16 |
AWX로 앤서블 사용하기 (0) | 2023.01.30 |
K8s 모니터링 하기 [prometheus,grafana] (0) | 2023.01.16 |
ArgoCD 설치 (4) | 2023.01.16 |