k3s를 이용한 최신 버전의 AWX 구축 방법
스펙 : CentOS 7 (최소 2vCPU/ 4Mem)
사전 설치 패키지
sudo yum -y install tar git make jq
curl -sfL https://get.k3s.io | sudo bash -
sudo chmod 644 /etc/rancher/k3s/k3s.yaml
sudo chown -R $USER. /etc/rancher
mkdir ~/.kube
sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
sudo chown -R $USER. ~/.kube/config
sudo systemctl status k3s.service
git clone https://github.com/ansible/awx-operator.git
export NAMESPACE=awx
kubectl create ns ${NAMESPACE}
kubectl config set-context --current --namespace=$NAMESPACE
cd awx-operator
RELEASE_TAG=`curl -s https://api.github.com/repos/ansible/awx-operator/releases/latest | grep tag_name | cut -d '"' -f 4`
echo $RELEASE_TAG
git checkout $RELEASE_TAG
git log -1
export NAMESPACE=awx
make deploy
약 5분 후 설치 확인
kubectl get pods -n awx
mkdir ~/awx
cd ~/awx
vi public-static-pvc.yaml
# 아래 코드 추가
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: public-static-data-pvc
spec:
accessModes:
- ReadWriteOnce
storageClassName: local-path
resources:
requests:
storage: 5Gi
# pvc 배포
kubectl apply -f public-static-pvc.yaml -n awx
kubectl get pvc -n awx
vi awx-instance-deployment.yml
#아래 내용 추가
---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
name: awx
namespace: awx
spec:
service_type: nodeport
projects_persistence: true
projects_storage_access_mode: ReadWriteOnce
ee_extra_env: |
- name: RECEPTOR_KUBE_SUPPORT_RECONNECT
value: enabled
web_extra_volume_mounts: |
- name: static-data
mountPath: /var/lib/projects
extra_volumes: |
- name: static-data
persistentVolumeClaim:
claimName: public-static-data-pvc
# AWX deployment 배포
kubectl apply -f awx-instance-deployment.yml -n awx
배포 완료까지 10분 정도의 시간이 소요될 수 있음
watch kubectl get pods -l "app.kubernetes.io/managed-by=awx-operator" -n awx
STATUS 가 모두 Running 상태면 배포가 완료됨
초기 관리자 계정의 경우 ID는 admin이고 패스워드는 아래 명령어로 확인
kubectl -n awx get secret awx-admin-password -o go-template='{{range $k,$v := .data}}{{printf "%s: " $k}}{{if not $v}}{{$v}}{{else}}{{$v | base64decode}}{{end}}{{"\n"}}{{end}}'
AWX 구축 완료 (๑❛ڡ❛๑)☆