docker:okd1
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| docker:okd1 [2026/03/20 13:33] – jonathan | docker:okd1 [2026/03/20 19:04] (current) – jonathan | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ===== OKD1 ===== | ===== OKD1 ===== | ||
| + | |||
| + | ==== VM spin-up ==== | ||
| + | |||
| + | <code - okd-spin_up-cp.sh> | ||
| + | #!/bin/bash | ||
| + | |||
| + | virsh destroy okd-bootstrap | ||
| + | virsh undefine okd-bootstrap | ||
| + | |||
| + | virsh destroy okd-cp1 | ||
| + | virsh undefine okd-cp1 | ||
| + | |||
| + | virsh destroy okd-cp2 | ||
| + | virsh undefine okd-cp2 | ||
| + | |||
| + | virsh destroy okd-cp3 | ||
| + | virsh undefine okd-cp3 | ||
| + | |||
| + | rm -rf / | ||
| + | ######################################################################## | ||
| + | |||
| + | |||
| + | # 1. Nettoyage et Copie de l' | ||
| + | wipefs -a / | ||
| + | qemu-img convert -O raw / | ||
| + | |||
| + | # 3. Préparation Ignition | ||
| + | cp bootstrap.ign / | ||
| + | chmod 777 / | ||
| + | IGNITION_DEVICE_ARG=" | ||
| + | |||
| + | # 4. Installation | ||
| + | virt-install \ | ||
| + | --name okd-bootstrap \ | ||
| + | --memory 16384 --vcpus 4 --cpu host-passthrough \ | ||
| + | --machine q35 --os-variant=fedora-coreos-stable \ | ||
| + | --disk path=/ | ||
| + | --network network=vlan219, | ||
| + | --graphics none \ | ||
| + | --import \ | ||
| + | --noautoconsole \ | ||
| + | " | ||
| + | |||
| + | ######################################################################## | ||
| + | |||
| + | # 1. Nettoyage et Copie de l' | ||
| + | wipefs -a / | ||
| + | qemu-img convert -O raw / | ||
| + | |||
| + | # 3. Préparation Ignition | ||
| + | cp master.ign / | ||
| + | chmod 777 / | ||
| + | IGNITION_DEVICE_ARG=" | ||
| + | |||
| + | # 4. Installation | ||
| + | virt-install \ | ||
| + | --name okd-cp1 \ | ||
| + | --memory 16384 --vcpus 4 --cpu host-passthrough \ | ||
| + | --machine q35 --os-variant=fedora-coreos-stable \ | ||
| + | --disk path=/ | ||
| + | --network network=vlan219, | ||
| + | --graphics none \ | ||
| + | --import \ | ||
| + | --noautoconsole \ | ||
| + | " | ||
| + | |||
| + | ######################################################################## | ||
| + | |||
| + | # 1. Nettoyage et Copie de l' | ||
| + | wipefs -a / | ||
| + | qemu-img convert -O raw / | ||
| + | |||
| + | |||
| + | # 3. Préparation Ignition | ||
| + | cp master.ign / | ||
| + | chmod 777 / | ||
| + | IGNITION_DEVICE_ARG=" | ||
| + | |||
| + | # 4. Installation | ||
| + | virt-install \ | ||
| + | --name okd-cp2 \ | ||
| + | --memory 16384 --vcpus 4 --cpu host-passthrough \ | ||
| + | --machine q35 --os-variant=fedora-coreos-stable \ | ||
| + | --disk path=/ | ||
| + | --network network=vlan219, | ||
| + | --graphics none \ | ||
| + | --import \ | ||
| + | --noautoconsole \ | ||
| + | " | ||
| + | |||
| + | ######################################################################## | ||
| + | |||
| + | # 1. Nettoyage et Copie de l' | ||
| + | wipefs -a / | ||
| + | qemu-img convert -O raw / | ||
| + | |||
| + | |||
| + | # 3. Préparation Ignition | ||
| + | cp master.ign / | ||
| + | chmod 777 / | ||
| + | IGNITION_DEVICE_ARG=" | ||
| + | |||
| + | # 4. Installation | ||
| + | virt-install \ | ||
| + | --name okd-cp3 \ | ||
| + | --memory 16384 --vcpus 4 --cpu host-passthrough \ | ||
| + | --machine q35 --os-variant=fedora-coreos-stable \ | ||
| + | --disk path=/ | ||
| + | --network network=vlan219, | ||
| + | --graphics none \ | ||
| + | --import \ | ||
| + | --noautoconsole \ | ||
| + | " | ||
| + | |||
| + | ######################################################################## | ||
| + | </ | ||
| + | |||
| + | <code - okd-spin_up-workers.sh> | ||
| + | #!/bin/bash | ||
| + | |||
| + | virsh destroy okd-worker1 | ||
| + | virsh undefine okd-worker1 | ||
| + | |||
| + | virsh destroy okd-worker2 | ||
| + | virsh undefine okd-worker2 | ||
| + | |||
| + | virsh destroy okd-worker3 | ||
| + | virsh undefine okd-worker3 | ||
| + | |||
| + | virsh destroy okd-worker4 | ||
| + | virsh undefine okd-worker4 | ||
| + | |||
| + | ######################################################################## | ||
| + | |||
| + | # 1. Nettoyage et Copie de l' | ||
| + | wipefs -a / | ||
| + | wipefs -a / | ||
| + | qemu-img convert -O raw / | ||
| + | |||
| + | # 3. Préparation Ignition | ||
| + | cp worker.ign / | ||
| + | chmod 777 / | ||
| + | IGNITION_DEVICE_ARG=" | ||
| + | |||
| + | # 4. Installation | ||
| + | virt-install \ | ||
| + | --name okd-worker1 \ | ||
| + | --memory 16384 --vcpus 4 --cpu host-passthrough \ | ||
| + | --machine q35 --os-variant=fedora-coreos-stable \ | ||
| + | --disk path=/ | ||
| + | --disk path=/ | ||
| + | --network network=vlan219, | ||
| + | --network network=ovsbr0, | ||
| + | --graphics none \ | ||
| + | --import \ | ||
| + | --noautoconsole \ | ||
| + | " | ||
| + | |||
| + | ######################################################################## | ||
| + | |||
| + | # 1. Nettoyage et Copie de l' | ||
| + | wipefs -a / | ||
| + | wipefs -a / | ||
| + | qemu-img convert -O raw / | ||
| + | |||
| + | # 3. Préparation Ignition | ||
| + | cp worker.ign / | ||
| + | chmod 777 / | ||
| + | IGNITION_DEVICE_ARG=" | ||
| + | |||
| + | # 4. Installation | ||
| + | virt-install \ | ||
| + | --name okd-worker2 \ | ||
| + | --memory 16384 --vcpus 4 --cpu host-passthrough \ | ||
| + | --machine q35 --os-variant=fedora-coreos-stable \ | ||
| + | --disk path=/ | ||
| + | --disk path=/ | ||
| + | --network network=vlan219, | ||
| + | --network network=ovsbr0, | ||
| + | --graphics none \ | ||
| + | --import \ | ||
| + | --noautoconsole \ | ||
| + | " | ||
| + | |||
| + | ######################################################################## | ||
| + | |||
| + | # 1. Nettoyage et Copie de l' | ||
| + | wipefs -a / | ||
| + | wipefs -a / | ||
| + | qemu-img convert -O raw / | ||
| + | |||
| + | # 3. Préparation Ignition | ||
| + | cp worker.ign / | ||
| + | chmod 777 / | ||
| + | IGNITION_DEVICE_ARG=" | ||
| + | |||
| + | # 4. Installation | ||
| + | virt-install \ | ||
| + | --name okd-worker3 \ | ||
| + | --memory 16384 --vcpus 4 --cpu host-passthrough \ | ||
| + | --machine q35 --os-variant=fedora-coreos-stable \ | ||
| + | --disk path=/ | ||
| + | --disk path=/ | ||
| + | --network network=vlan219, | ||
| + | --network network=ovsbr0, | ||
| + | --graphics none \ | ||
| + | --import \ | ||
| + | --noautoconsole \ | ||
| + | " | ||
| + | |||
| + | ######################################################################## | ||
| + | |||
| + | # 1. Nettoyage et Copie de l' | ||
| + | wipefs -a / | ||
| + | wipefs -a / | ||
| + | qemu-img convert -O raw / | ||
| + | |||
| + | # 3. Préparation Ignition | ||
| + | cp worker.ign / | ||
| + | chmod 777 / | ||
| + | IGNITION_DEVICE_ARG=" | ||
| + | |||
| + | # 4. Installation | ||
| + | virt-install \ | ||
| + | --name okd-worker4 \ | ||
| + | --memory 16384 --vcpus 4 --cpu host-passthrough \ | ||
| + | --machine q35 --os-variant=fedora-coreos-stable \ | ||
| + | --disk path=/ | ||
| + | --disk path=/ | ||
| + | --network network=vlan219, | ||
| + | --network network=ovsbr0, | ||
| + | --graphics none \ | ||
| + | --import \ | ||
| + | --noautoconsole \ | ||
| + | " | ||
| + | </ | ||
| + | |||
| ==== Installation command ==== | ==== Installation command ==== | ||
| Line 356: | Line 593: | ||
| </ | </ | ||
| + | \n | ||
| + | \n | ||
| + | ===== Creating Local Users in OKD 4.21 Using HTPasswd ===== | ||
| + | |||
| + | A fresh OKD installation only provides the ``kubeadmin`` user. | ||
| + | To allow local users to log in and deploy pods, configure an HTPasswd | ||
| + | identity provider. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Step 1: Create the htpasswd file ==== | ||
| + | |||
| + | <code bash> | ||
| + | docker run --rm \ | ||
| + | -v $(pwd):/ | ||
| + | docker.io/ | ||
| + | htpasswd -cbB / | ||
| + | |||
| + | docker run --rm \ | ||
| + | -v $(pwd):/ | ||
| + | docker.io/ | ||
| + | htpasswd -bB / | ||
| + | | ||
| + | docker run --rm \ | ||
| + | -v $(pwd):/ | ||
| + | docker.io/ | ||
| + | htpasswd -bB / | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Step 2: Create the secret in the openshift-config namespace ==== | ||
| + | |||
| + | <code bash> | ||
| + | oc create secret generic htpasswd-secret \ | ||
| + | --from-file=htpasswd=users.htpasswd \ | ||
| + | -n openshift-config | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Step 3: Configure OAuth to use HTPasswd ==== | ||
| + | |||
| + | Edit the OAuth configuration: | ||
| + | |||
| + | <code bash> | ||
| + | oc edit oauth cluster | ||
| + | </ | ||
| + | |||
| + | Add: | ||
| + | |||
| + | <code yaml> | ||
| + | spec: | ||
| + | identityProviders: | ||
| + | - name: local-users | ||
| + | mappingMethod: | ||
| + | type: HTPasswd | ||
| + | htpasswd: | ||
| + | fileData: | ||
| + | name: htpasswd-secret | ||
| + | </ | ||
| + | |||
| + | Wait for the OAuth operator to restart. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Step 4: Test login ==== | ||
| + | |||
| + | Log out of the Web Console and log in with: | ||
| + | |||
| + | * Username: ``myuser`` | ||
| + | * Password: ``MyPassword123`` | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Step 5: Grant permissions to the new user ==== | ||
| + | |||
| + | Allow user to create their own Projects: | ||
| + | |||
| + | <code bash> | ||
| + | oc adm policy add-cluster-role-to-user self-provisioner myuser | ||
| + | </ | ||
| + | |||
| + | Or give admin access to a specific namespace: | ||
| + | |||
| + | <code bash> | ||
| + | oc adm policy add-role-to-user admin myuser -n mynamespace | ||
| + | </ | ||
| + | The user can now create and run pods. | ||
docker/okd1.1774013617.txt.gz · Last modified: by jonathan
