Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing AWX on kubernetes cluster using Helm and Ansible #1958

Open
3 tasks done
calm329 opened this issue Sep 17, 2024 · 1 comment
Open
3 tasks done

Installing AWX on kubernetes cluster using Helm and Ansible #1958

calm329 opened this issue Sep 17, 2024 · 1 comment

Comments

@calm329
Copy link

calm329 commented Sep 17, 2024

Please confirm the following

  • I agree to follow this project's code of conduct.
  • I have checked the current issues for duplicates.
  • I understand that the AWX Operator is open source software provided for free and that I might not receive a timely response.

Bug Summary

I am trying to install AWX on kubernetes cluster using Helm and Ansible
I tried to follow https://www.linuxtechi.com/install-ansible-awx-on-kubernetes-cluster/.
But still getting errors
My helm version is 1.27.1

AWX Operator version

not sure

AWX version

not sure

Kubernetes platform

kubernetes

Kubernetes/Platform version

1.30

Modifications

no

Steps to reproduce

This is my current Ansible playbook file

  • name: Prepare directories for PostgreSQL
    hosts: all
    become: yes
    tasks:

    • name: Ensure postgres user exists
      user:
      name: postgres
      state: present

    • name: Create /mnt/storage directory
      file:
      path: /mnt/storage
      state: directory
      mode: "0755"
      owner: postgres
      group: postgres

  • name: Install AWX on Kubernetes using Helm
    hosts: master_node
    become: yes
    collections:

    • kubernetes.core
      vars:
      helm_repo: "https://ansible-community.github.io/awx-operator-helm/"
      helm_chart: "awx-operator"
      k8s_namespace: "awx"
      awx_cr: |
      apiVersion: awx.ansible.com/v1beta1
      kind: AWX
      metadata:
      name: awx
      namespace: awx
      spec:
      service_type: nodeport
      postgres_storage_class: local-storage # Specify the storage class for PostgreSQL
      pv_config: |
      apiVersion: v1
      kind: PersistentVolume
      metadata:
      name: postgres-15-pv
      namespace: awx
      spec:
      capacity:
      storage: 10Gi
      accessModes:
      - ReadWriteOnce
      local:
      path: /mnt/storage # Ensure this path exists on the node
      storageClassName: local-storage
      nodeAffinity:
      required:
      nodeSelectorTerms:
      - matchExpressions:
      - key: kubernetes.io/hostname
      operator: In
      values:
      - ubuntu-4gb-nbg1-2
      pvc_config: |
      apiVersion: v1
      kind: PersistentVolumeClaim
      metadata:
      name: postgres-15-awx-postgres-15-0
      namespace: awx
      spec:
      accessModes:
      - ReadWriteOnce
      resources:
      requests:
      storage: 10Gi
      storageClassName: local-storage
      local_storage_config: |
      apiVersion: storage.k8s.io/v1
      kind: StorageClass
      metadata:
      name: local-storage
      namespace: awx
      provisioner: kubernetes.io/no-provisioner
      volumeBindingMode: WaitForFirstConsumer
      tasks:

    • name: Add AWX Helm repository
      command: helm repo add awx-operator "{{ helm_repo }}"

    • name: Update Helm repositories
      command: helm repo update

    • name: Create AWX namespace if it doesn't exist
      kubernetes.core.k8s:
      state: present
      definition:
      apiVersion: v1
      kind: Namespace
      metadata:
      name: "{{ k8s_namespace }}"

    • name: Create Local Storage class
      kubernetes.core.k8s:
      state: present
      definition: "{{ local_storage_config }}"

    • name: Create Persistent Volume if it doesn't exist
      kubernetes.core.k8s:
      state: present
      definition: "{{ pv_config }}"

    • name: Create Persistent Volume Claim if it doesn't exist
      kubernetes.core.k8s:
      state: present
      definition: "{{ pvc_config }}"

    • name: Install AWX Operator using Helm
      command: helm install awx-operator awx-operator/"{{ helm_chart }}" --namespace "{{ k8s_namespace }}" --create-namespace

    • name: Deploy AWX using custom resource
      copy:
      content: "{{ awx_cr }}"
      dest: /tmp/awx-cr.yml

    • name: Apply AWX custom resource
      shell: kubectl apply -f /tmp/awx-cr.yml

    • name: Verify Kubernetes config permissions
      command: chmod 600 /root/.kube/config
      when: ansible_facts['user_id'] == 0 # Only run this when the user is root

    • name: Clean up temporary Helm GPG key
      file:
      path: /tmp/helm-signing.asc
      state: absent

Expected results

image

Actual results

image

Additional information

My helm version is 2.19.1

Operator Logs

My OS is ubuntu 24.04

@sc-yan
Copy link

sc-yan commented Oct 3, 2024

you claimed you are following the guide to install awx, but you pasted a ansible playbook to install awx. is there any particular reason? I think the guide is using k8s manifest/helm charts to manage awx.

My helm version is 1.27.1
My helm version is 2.19.1

also, whichever your version is, try helm v3 first. v2 is deprecated long ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants