tech:notes_k8s_-_kind_pour_awx
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| tech:notes_k8s_-_kind_pour_awx [2025/12/10 10:03] – Jean-Baptiste | tech:notes_k8s_-_kind_pour_awx [2026/03/03 13:51] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Notes k8s - kind pour AWX | ||
| + | |||
| + | Voir : | ||
| + | * [[Pb cgroup controllers not delegated to non-privileged users - SystemD delegate failed - cgroupControllers]] | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | Voir aussi : | ||
| + | * kinder | ||
| + | * https:// | ||
| + | |||
| + | Avantage / Intérêts d' | ||
| + | * https:// | ||
| + | * http:// | ||
| + | * Gestion des secrets (natif ou hachicorp Vault) | ||
| + | * Traçabilité logs | ||
| + | * Scalabilité | ||
| + | * RBAC | ||
| + | * API REST | ||
| + | * Empêcher les accès concurrentiels | ||
| + | * WorkFlow AWX | ||
| + | * Pouvoir rejouer le même playbook, avec exactement les mêmes entrés en garantissant la reproductibilité via un Execution Environment | ||
| + | * Ansible Galaxy Integration (et gestion dépendances des collections / rôles) | ||
| + | * Contrôle des extravars (surveys) | ||
| + | * Planification (schedules) | ||
| + | Reducing complexity | ||
| + | * EE : software dependencies, | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | Source : https:// | ||
| + | |||
| + | Voir aussi : | ||
| + | * [[Notes Kubernetes k8s - Install]] | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | |||
| + | How to reference a local volume in Kind (kubernetes in container) | ||
| + | * https:// | ||
| + | |||
| + | Il faut containerd | ||
| + | |||
| + | Une fois le cluster crée il n'est pas possible de le modifier. | ||
| + | Prévoir de pouvoir restaurer la conf près un " | ||
| + | |||
| + | Voir aussi : | ||
| + | * containers-storage | ||
| + | |||
| + | Kube kind | ||
| + | |||
| + | https:// | ||
| + | |||
| + | https:// | ||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | KIND_EXPERIMENTAL_PROVIDER=nerdctl | ||
| + | |||
| + | # nerdctl / kind a besoin de connaitre le chemin de iptables | ||
| + | export PATH=$PATH:/ | ||
| + | ~~~ | ||
| + | |||
| + | Install de kind via asdf (voir aussi mise.run) | ||
| + | ~~~bash | ||
| + | asdf plugin add kind | ||
| + | asdf install kind latest | ||
| + | asdf set --home kind latest | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | Pour Podman | ||
| + | |||
| + | Si nouvelle partition | ||
| + | ~~~bash | ||
| + | mkfs.xfs -n ftype=1 -m reflink=1 / | ||
| + | ~~~ | ||
| + | Pour le rootless : pas de homedir monté en noexec/ | ||
| + | source : https:// | ||
| + | |||
| + | ~~~bash | ||
| + | export KIND_EXPERIMENTAL_PROVIDER=podman | ||
| + | systemd-run --scope --user kind create cluster | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | Rootless | ||
| + | |||
| + | Enable cgroup v2 delegation, see https:// | ||
| + | Source : https:// | ||
| + | |||
| + | Pour rootless avec iptables | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | ip6_tables | ||
| + | ip6table_nat | ||
| + | ip_tables | ||
| + | iptable_nat | ||
| + | ~~~ | ||
| + | |||
| + | Si nftable à la place d' | ||
| + | ~~~yaml | ||
| + | kind: Cluster | ||
| + | apiVersion: kind.x-k8s.io/ | ||
| + | networking: | ||
| + | ipFamily: ipv4 | ||
| + | kubeProxyMode: | ||
| + | ~~~ | ||
| + | |||
| + | Pour nerdctl | ||
| + | ~~~ | ||
| + | KIND_EXPERIMENTAL_PROVIDER=nerdctl kind create cluster | ||
| + | ~~~ | ||
| + | |||
| + | A titre d' | ||
| + | Mais idéalement il faudrait ajouter un '' | ||
| + | |||
| + | ~~~ | ||
| + | Running as unit: run-p8566-i8567.scope; | ||
| + | Creating cluster " | ||
| + | ✓ Ensuring node image (kindest/ | ||
| + | ✓ Preparing nodes 📦 | ||
| + | ✓ Writing configuration 📜 | ||
| + | ✓ Starting control-plane 🕹 | ||
| + | ✓ Installing CNI 🔌 | ||
| + | ✓ Installing StorageClass 💾 | ||
| + | Set kubectl context to " | ||
| + | You can now use your cluster with: | ||
| + | |||
| + | kubectl cluster-info --context kind-kind | ||
| + | |||
| + | Not sure what to do next? 😅 Check out https:// | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | install Nginx Ingress controller | ||
| + | ~~~bash | ||
| + | kubectl apply -f https:// | ||
| + | ~~~ | ||
| + | |||
| + | ------ | ||
| + | |||
| + | Get kind images list : | ||
| + | ~~~bash | ||
| + | nerdctl exec -ti kind-control-plane crictl images | ||
| + | ~~~ | ||
| + | |||
| + | Cet logs | ||
| + | ~~~bash | ||
| + | kind export logs | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ------ | ||
| + | |||
| + | ~~~bash | ||
| + | kubectl port-forward svc/ | ||
| + | ~~~ | ||
| + | |||
| + | https:// | ||
| + | |||
| + | |||
| + | ------ | ||
| + | |||
| + | Delete | ||
| + | |||
| + | https:// | ||
| + | |||
| + | |||
| + | Erreur pv pvc | ||
| + | https:// | ||
| + | |||
| + | https:// | ||
| + | |||
| + | |||
| + | ### Démarage auto | ||
| + | |||
| + | Ne fonctionne pas | ||
| + | ~~~bash | ||
| + | nerdctl update --restart unless-stopped kind-control-plane | ||
| + | ~~~ | ||
| + | |||
| + | Serait-ce lié à https:// | ||
| + | |||
| + | |||
| + | Voir aussi '' | ||
| + | |||
| + | '' | ||
| + | ~~~ini | ||
| + | [Unit] | ||
| + | Description=Container kind-control-plane | ||
| + | Wants=network-online.target | ||
| + | After=network-online.target | ||
| + | # | ||
| + | |||
| + | [Service] | ||
| + | Delegate=yes | ||
| + | # | ||
| + | Type=oneshot | ||
| + | RemainAfterExit=yes | ||
| + | # | ||
| + | Environment=PODMAN_SYSTEMD_UNIT=%n | ||
| + | Environment=DBUS_SESSION_BUS_ADDRESS=unix: | ||
| + | Environment=XDG_RUNTIME_DIR=/ | ||
| + | ExecStartPre=/ | ||
| + | ExecStartPre=/ | ||
| + | # | ||
| + | RemainAfterExit=yes | ||
| + | # | ||
| + | ExecStart=/ | ||
| + | ExecStop=/ | ||
| + | NotifyAccess=all | ||
| + | |||
| + | [Install] | ||
| + | WantedBy=default.target | ||
| + | ~~~ | ||
| + | |||
| + | Voir aussi : | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | systemctl --user daemon-reload | ||
| + | systemctl --user enable container-kind-control-plane.service | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Pb | ||
| + | |||
| + | ### Err failed to create fsnotify watcher - too many open files | ||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | kubectl get pods | ||
| + | kubectl logs -f awx-764564987d-wtw2f | ||
| + | failed to create fsnotify watcher: too many open files | ||
| + | ~~~ | ||
| + | |||
| + | Solution | ||
| + | |||
| + | ''/ | ||
| + | |||
| + | ~~~python | ||
| + | # Raise inotify resource limits | ||
| + | fs.inotify.max_user_instances = 1024 | ||
| + | fs.inotify.max_user_watches = 524288 | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | sysctl -p / | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## AWX | ||
| + | |||
| + | Voir : | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | kubectl get secret awx-admin-password -o jsonpath=" | ||
| + | ~~~ | ||
| + | |||
| + | '' | ||
| + | ~~~bash | ||
| + | function awx-manage() { | ||
| + | # podman exec -ti kind-control-plane crictl exec -ti --name awx-task awx-manage " | ||
| + | nerdctl exec -ti kind-control-plane -- crictl exec -ti --name awx-task awx-manage " | ||
| + | } | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | nerdctl exec -ti kind-control-plane -- crictl exec -ti --name awx-task /bin/bash | ||
| + | cd /tmp/ | ||
| + | python3 -m venv ipython | ||
| + | cd ipython/ | ||
| + | source bin/ | ||
| + | pip install ipython | ||
| + | |||
| + | export PYTHONPATH=/ | ||
| + | awx-manage shell_plus --ipython | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | ------ | ||
| + | |||
| + | ~~~yaml | ||
| + | kind: Cluster | ||
| + | apiVersion: kind.x-k8s.io/ | ||
| + | nodes: | ||
| + | - role: control-plane | ||
| + | extraMounts: | ||
| + | - containerPath: | ||
| + | hostPath: / | ||
| + | - containerPath: | ||
| + | hostPath: /data/files | ||
| + | readOnly: true | ||
| + | - containerPath: | ||
| + | hostPath: / | ||
| + | |||
| + | # Si module nf_tables est présent à la pace de iptables | ||
| + | networking: | ||
| + | kubeProxyMode: | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | kind create cluster --config cluster-config.yml | ||
| + | |||
| + | kubectl get pods -A -w | ||
| + | |||
| + | git clone https:// | ||
| + | cd awx-operator | ||
| + | |||
| + | export NAMESPACE=awx | ||
| + | |||
| + | kubectl create ns ${NAMESPACE} | ||
| + | kubectl config set-context --current --namespace=$NAMESPACE | ||
| + | |||
| + | export RELEASE_TAG=`curl -s https:// | ||
| + | git checkout $RELEASE_TAG | ||
| + | |||
| + | cd config/ | ||
| + | ~/ | ||
| + | |||
| + | cd ~/ | ||
| + | ~/ | ||
| + | |||
| + | kubectl get pods -w | ||
| + | |||
| + | |||
| + | tee awx-pv.yml <<EOF | ||
| + | --- | ||
| + | apiVersion: v1 | ||
| + | kind: PersistentVolume | ||
| + | metadata: | ||
| + | name: awx-postgres-13-volume | ||
| + | spec: | ||
| + | accessModes: | ||
| + | - ReadWriteOnce | ||
| + | persistentVolumeReclaimPolicy: | ||
| + | capacity: | ||
| + | storage: 8Gi | ||
| + | storageClassName: | ||
| + | hostPath: | ||
| + | path: / | ||
| + | |||
| + | --- | ||
| + | apiVersion: v1 | ||
| + | kind: PersistentVolume | ||
| + | metadata: | ||
| + | name: awx-projects-volume | ||
| + | spec: | ||
| + | accessModes: | ||
| + | - ReadWriteOnce | ||
| + | persistentVolumeReclaimPolicy: | ||
| + | capacity: | ||
| + | storage: 2Gi | ||
| + | storageClassName: | ||
| + | hostPath: | ||
| + | path: / | ||
| + | EOF | ||
| + | |||
| + | kubectl apply -f awx-pv.yml | ||
| + | |||
| + | kubectl get pv -w | ||
| + | |||
| + | tee awx-pvc.yml <<EOF | ||
| + | --- | ||
| + | apiVersion: v1 | ||
| + | kind: PersistentVolumeClaim | ||
| + | metadata: | ||
| + | name: awx-projects-claim | ||
| + | spec: | ||
| + | accessModes: | ||
| + | - ReadWriteOnce | ||
| + | volumeMode: Filesystem | ||
| + | resources: | ||
| + | requests: | ||
| + | storage: 2Gi | ||
| + | storageClassName: | ||
| + | EOF | ||
| + | |||
| + | kubectl apply -f awx-pvc.yml | ||
| + | |||
| + | kubectl get pvc -w | ||
| + | |||
| + | |||
| + | tee awx-deployment.yml<< | ||
| + | --- | ||
| + | apiVersion: awx.ansible.com/ | ||
| + | kind: AWX | ||
| + | metadata: | ||
| + | name: awx | ||
| + | spec: | ||
| + | # These parameters are designed for use with AWX Operator 0.29.0 | ||
| + | # and AWX 21.6.0 | ||
| + | postgres_configuration_secret: | ||
| + | postgres_storage_class: | ||
| + | postgres_storage_requirements: | ||
| + | requests: | ||
| + | storage: 8Gi | ||
| + | projects_persistence: | ||
| + | garbage_collect_secrets: | ||
| + | projects_existing_claim: | ||
| + | postgres_init_container_resource_requirements: | ||
| + | postgres_resource_requirements: | ||
| + | web_resource_requirements: | ||
| + | task_resource_requirements: | ||
| + | ee_resource_requirements: | ||
| + | service_type: | ||
| + | ingress_type: | ||
| + | hostname: awx.robert.local | ||
| + | ingress_annotations: | ||
| + | kubernetes.io/ | ||
| + | EOF | ||
| + | |||
| + | kubectl apply -f awx-deployment.yml | ||
| + | |||
| + | kubectl get AWX -w | ||
| + | |||
| + | |||
| + | # nerdctl exec -ti kind-control-plane bash | ||
| + | # mkdir / | ||
| + | ~~~ | ||
| + | |||
