### Helper Script Workflow for OKD Install Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/upi-sno.md Outlines the sequential execution of a helper script (`virt-env-install.sh`) for automating various stages of the OKD installation, from environment configuration and DNS setup to VM creation and the final OKD installation steps. ```bash ./virt-env-install.sh config # configures install-config.yaml ./virt-env-install.sh dnsconfig # before continuing manually test your dns setup ./virt-env-install.sh haproxy ./virt-env-install.sh firewall # can be ignored as firewalld has been disabled ./virt-env-install.sh network ./virt-env-install.sh manifests ./virt-env-install.sh ignition ./virt-env-install.sh copy ./virt-env-install.sh vm bootstrap ok (repeat this for each vm needed) ./virt-env-install.sh vm cp-1 ok ./virt-env-install.sh okd-install bootstrap ./virt-env-install.sh okd-install install ``` -------------------------------- ### CoreOS Ignition URL Examples Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/upi-sno.md Provides example `--ignition-url` parameters for different node types (bootstrap, master, worker) during CoreOS installation. ```bash --ignition-url https://192.168.122.1:8080/okd4/bootstrap.ign ``` ```bash --ignition-url https://192.168.122.1:8080/okd4/master.ign ``` ```bash --ignition-url https://192.168.122.1:8080/okd4/worker.ign ``` -------------------------------- ### Enable and Start Apache HTTP Server Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/upi-sno.md Enables the Apache HTTP Server service to start automatically on boot and then starts the service immediately. It also shows the current status of the service. ```bash systemctl enable httpd systemctl start httpd systemctl status httpd ``` -------------------------------- ### Start HAProxy Service using systemctl Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/upi-sno.md This command initiates the HAProxy service on a system using systemd. It assumes HAProxy is installed and configured. ```bash sudo systemctl start haproxy ``` -------------------------------- ### Serve OKD Installation Files Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/upi-sno.md Sets up a web server directory to host the generated OKD installation and configuration files. It copies the necessary files, moves the Core OS image, and applies correct ownership and SELinux contexts for HTTP access. ```shell mkdir /var/www/html/okd4 cp -R ~/okd-install/* /var/www/html/okd4 mv ~/fhcos-X.X.X-x86_64-metal.x86_64.raw.gz /var/www/html/okd4/fhcos chcon -R -t httpd_sys_content_t /var/www/html/okd4/ chown -R apache: /var/www/html/okd4/ chmod 755 /var/www/html/okd4/ ``` -------------------------------- ### Start dnsmasq Service Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/upi-sno.md This command starts the dnsmasq service using a specified configuration file. It is essential for applying the DNS settings defined in the configuration. Ensure you have the necessary permissions (sudo) to execute this command. ```bash sudo /usr/sbin/dnsmasq --conf-file=/etc/dnsmasq.conf ``` -------------------------------- ### Install and Configure NFS Server Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/upi-sno.md Installs the NFS utilities, creates a shared directory for the OKD registry, configures exports for network access, and enables/starts the necessary NFS services. ```shell sudo dnf install nfs-utils -y mkdir -p /shares/registry chown -R nobody:nobody /shares/registry chmod -R 777 /shares/registry echo "/shares/registry 192.168.122.0/24(rw,sync,root_squash,no_subtree_check,no_wdelay)" > /etc/exports exportfs -rv sudo systemctl enable nfs-server rpcbind sudo systemctl start nfs-server rpcbind nfs-mountd ``` -------------------------------- ### Extract OKD Tools from Container Image Source: https://github.com/okd-project/okd-web/blob/main/docs/project/installation.md Uses the `oc adm release extract` command to download and extract the OKD installer and client from a specified container image. Requires a 4.x version of the `oc` client. ```shell oc adm release extract --tools quay.io/openshift/okd:4.5.0-0.okd-2020-07-14-153706-ga ``` -------------------------------- ### Run and Stop OKD Assisted Installer with Podman Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/sno-assisted-installer.md Commands to start and stop the Assisted Installer using Podman on a local machine. Requires Podman to be initialized and running. Configuration is managed via a 'sno.yaml' file. ```shell podman machine init podman machine start ``` ```shell podman play kube sno.yaml ``` ```shell podman play kube --down sno.yaml ``` -------------------------------- ### Install HAProxy Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/vsphere-prereqs.md Installs the HAProxy package using apt-get, a high-performance TCP/HTTP load balancer and proxying solution. ```shell sudo apt-get install haproxy ``` -------------------------------- ### Install Virtualization Software (dnf) Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/upi-sno.md Installs the virtualization group of packages on Fedora-based systems using the dnf package manager. This is a prerequisite for setting up virtual machines. ```bash sudo dnf install @virtualization ``` -------------------------------- ### OKD Installation Wait Commands Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/upi-sno.md Commands to monitor the OKD installation process, waiting for the bootstrap service to complete and then for the overall installation to finish. Includes log level setting for debugging. ```bash openshift-install --dir ~/$INSTALL_DIR wait-for bootsrap-complete --log-level=debug ``` ```bash openshift-install --dir ~/$INSTALL_DIR wait-for install-complete --log-level=debug ``` -------------------------------- ### Use OKD Official Installation Container (Bash) Source: https://github.com/okd-project/okd-web/blob/main/docs/project/faq.md This bash script shows how to use the official OKD installer container to perform tasks like creating ignition configurations. It first finds the installer image and then runs it with specific commands. ```bash # Find out the installer image. oc adm release info quay.io/openshift/okd:4.7.0-0.okd-2021-04-24-103438 --image-for=installer # Example output # quay.io/openshift/okd-content@sha256:521cd3ac7d826749a085418f753f1f909579e1aedfda704dca939c5ea7e5b105 # Run the container via Podman or Docker to perform tasks. e.g. create ignition configurations docker run -v $(pwd):/output -ti quay.io/openshift/okd-content@sha256:521cd3ac7d826749a085418f753f1f909579e1aedfda704dca939c5ea7e5b105 create ignition-configs ``` -------------------------------- ### Verify OKD Downloads Source: https://github.com/okd-project/okd-web/blob/main/docs/project/installation.md Commands to import the public GPG key, verify the signature of the download manifest, and check the integrity of downloaded files using SHA256. ```shell curl https://www.okd.io/vrutkovs.pub | gpg --import ``` ```shell gpg --verify sha256sum.txt.asc sha256sum.txt ``` ```shell sha25sum -c sha25sum.txt ``` -------------------------------- ### Install Apache HTTP Server (dnf) Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/upi-sno.md Installs the Apache HTTP Server (httpd) on a Fedora-based system using dnf. This web server is used for serving content during the OKD installation process. ```bash dnf install httpd -y ``` -------------------------------- ### Install CoreOS with Master Ignition Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/upi-sno.md Demonstrates the `coreos-installer` command to install an image onto a device, specifying the ignition URL, image URL, and security options. Note that the device name might differ (e.g., `/dev/vda` for Fedora CoreOS). ```bash $ sudo coreos-installer install /dev/sda --ignition-url http://192.168.122.1:8080/okd4/master.ign --image-url http://192.168.122.1:8080/okd4/fhcos --insecure-ignition -–insecure ``` -------------------------------- ### Generate Ignition Configs for OKD Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/upi-sno.md Generates the Ignition configuration files and Kubernetes authentication files necessary for booting and provisioning OKD nodes. These are crucial for the initial setup of the cluster. ```shell ~/openshift-install create ignition-configs --dir ~/okd-install ``` -------------------------------- ### Run MkDocs Live Edit Source: https://github.com/okd-project/okd-web/blob/main/docs/community/wg_docs/doc-env.md Starts a local live preview of the MkDocs website. Changes are automatically reflected in the browser upon saving files. This command is typically run within the Che environment. ```shell mkdocs serve ``` -------------------------------- ### Run MkDocs Live Server with Docker Source: https://github.com/okd-project/okd-web/blob/main/docs/community/wg_docs/doc-env.md Starts a live local copy of the okd.io documentation website using a Docker container. It mounts the current directory (`pwd`) to the container's `/site` directory, allowing changes to be automatically reflected. The server is accessible on port 8000. ```shell docker run -it --rm --name mkdocs-serve -p 8000:8000 -v `pwd`:/site mkdocs-build ``` -------------------------------- ### Install Python Packages Source: https://github.com/okd-project/okd-web/blob/main/docs/community/wg_docs/doc-env.md Installs the Python dependencies required for MkDocs and other tooling from the 'requirements.txt' file. ```shell pip install -r requirements.txt ``` -------------------------------- ### Create and Destroy OKD Cluster Source: https://github.com/okd-project/okd-web/blob/main/docs/project/installation.md Shell commands to initiate the creation of an OKD cluster and to remove an existing cluster along with its associated cloud resources. ```shell openshift-install create cluster ``` ```shell openshift-install destroy cluster ``` -------------------------------- ### Test Apache HTTP Server Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/upi-sno.md Makes a GET request to the Apache HTTP Server running on localhost at port 8080 using curl. This verifies that the web server is running and accessible. ```bash curl localhost:8080 ``` -------------------------------- ### Add OKD Cluster Access to /etc/hosts Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/upi-sno.md Provides an example entry for the `/etc/hosts` file to enable remote access to the OKD cluster. It maps cluster service hostnames to a specific IP address, assumed to be the load balancer's IP. ```text 192.168.8.122 okd-svc api.lab.okd.lan api-int.lab.okd.lan console-openshift-console.apps.lab.okd.lan oauth-openshift.apps.lab.okd.lan downloads-openshift-console.apps.lab.okd.lan alertmanager-main-openshift-monitoring.apps.lab.okd.lan grafana-openshift-monitoring.apps.lab.okd.lan prometheus-k8s-openshift-monitoring.apps.lab.okd.lan thanos-querier-openshift-monitoring.apps.lab.okd.lan ``` -------------------------------- ### Install BIND9 DNS Server Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/vsphere-prereqs.md Installs the BIND9 DNS server and dnsutils package, which provides tools for DNS querying and diagnostics. BIND9 is a widely used DNS software. ```shell sudo apt install bind9 dnsutils ``` -------------------------------- ### CSpell and Link Checker Output Example Source: https://github.com/okd-project/okd-web/blob/main/docs/community/wg_docs/doc-env.md Example output from the CSpell (spell checker) and link checker tools. A successful build and validation should report zero issues found for both spelling and links. ```text CSpell: Files checked: 31, Issues found: 0 in 0 files That's it. 662 links in 695 URLs checked. 0 warnings found. 0 errors found ``` -------------------------------- ### OKD Installation Configuration File (install-config.yaml) Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/upi-sno.md Defines the core configuration parameters for an OKD cluster, including base domain, compute and control plane settings, networking details, and platform specifics. Requires user-specific pull secrets and SSH keys. ```yaml apiVersion: v1 baseDomain: okd.lan compute: - hyperthreading: Enabled name: worker replicas: 0 # Must be set to 0 for User Provisioned Installation as worker nodes will be manually deployed. controlPlane: hyperthreading: Enabled name: master replicas: 3 metadata: name: lab # Cluster name networking: clusterNetwork: - cidr: 10.128.0.0/14 hostPrefix: 23 networkType: OpenShiftSDN serviceNetwork: - 172.30.0.0/16 platform: none: {} fips: false pullSecret: 'add your pull secret here' sshKey: 'add your ssh public key here' ``` -------------------------------- ### Install Node.js Dependencies and Spell Checker Source: https://github.com/okd-project/okd-web/blob/main/docs/community/wg_docs/doc-env.md Installs project dependencies using npm and specifically installs the CSpell command-line tool globally for spell checking. ```shell npm ci ``` ```shell npm -g i cspell ``` -------------------------------- ### Install HAProxy Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/upi-sno.md Installs HAProxy, a high-performance TCP/HTTP load balancer and proxying solution, on a Fedora-based system using the dnf package manager. HAProxy is used for load balancing traffic to the OKD cluster nodes. ```bash dnf install haproxy -y ``` -------------------------------- ### dnsmasq Configuration for DNS and DHCP Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/upi-sno.md This is a sample configuration file for dnsmasq, a lightweight DNS forwarder and DHCP server. It includes settings for filtering queries, binding to interfaces, and managing DHCP clients. ```bash # Configuration file for dnsmasq. port=53 # The following two options make you a better netizen, since they # tell dnsmasq to filter out queries which the public DNS cannot # answer, and which load the servers (especially the root servers) # unnecessarily. If you have a dial-on-demand link they also stop # these requests from bringing up the link unnecessarily. # Never forward plain names (without a dot or domain part) #domain-needed # Never forward addresses in the non-routed address spaces. bogus-priv no-poll user=dnsmasq group=dnsmasq bind-interfaces no-hosts # Include all files in /etc/dnsmasq.d except RPM backup files conf-dir=/etc/dnsmasq.d,.rpmnew,.rpmsave,.rpmorig # If a DHCP client claims that its name is "wpad", ignore that. ``` -------------------------------- ### Check Apache Accessibility Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/upi-sno.md Verifies if files in `/var/www/html/ocp4/` are accessible via Apache on localhost. ```bash curl localhost:8080/okd4/ ``` -------------------------------- ### Generate OKD Manifests Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/upi-sno.md Generates Kubernetes manifest files required for OKD cluster installation using the 'openshift-install' command. This includes creating configuration files based on the provided install-config.yaml. ```shell ~/openshift-install create manifests --dir ~/okd-install ``` -------------------------------- ### Automated OKD Installation Wrapper Script (Bash) Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/automated-vsphere-upi.md This script automates the OpenShift/OKD installation on vSphere with UPI. It uses `oct.sh` to import templates, install tools, generate ignition files, build cluster nodes, and power them on. Finally, it uses `openshift-install` to wait for the bootstrap process to complete. It requires pre-configured DNS, DHCP, and load balancer infrastructure. ```shell #!/bin/bash masters_count=3 workers_count=2 template_url="https://builds.coreos.fedoraproject.org/prod/streams/testing/builds/33.20210314.2.0/x86_64/fedora-coreos-33.20210314.2.0-vmware.x86_64.ova" template_name="fedora-coreos-33.20210201.2.1-vmware.x86_64" library="Linux ISOs" cluster_name="mycluster" cluster_folder="/MyVSPHERE/vm/Linux/OKD/mycluster" network_name="VM Network" install_folder=`pwd` # Import the template ./oct.sh --import-template --library "${library}" --template-url "${template_url}" # Install the desired OKD tools oct.sh --install-tools --release 4.6 # Launch the prerun to generate and modify the ignition files oct.sh --prerun --auto-secret # Deploy the nodes for the cluster with the appropriate ignition data oct.sh --build --template-name "${template_name}" --library "${library}" --cluster-name "${cluster_name}" --cluster-folder "${cluster_folder}" --network-name "${network_name}" --installation-folder "${install_folder}" --master-node-count ${masters_count} --worker-node-count ${workers_count} # Turn on the cluster nodes oct.sh --cluster-power on --cluster-name "${cluster_name}" --master-node-count ${masters_count} --worker-node-count ${workers_count} # Run the OpenShift installer bin/openshift-install --dir=$(pwd) wait-for bootstrap-complete --log-level=info ``` -------------------------------- ### Create Assisted Installer Configuration (sno.yaml) Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/sno-assisted-installer.md This YAML configuration file defines settings for the Assisted Installer and its dependencies when run with Podman. It includes environment variables for the service, database, and image configurations, as well as Pod definitions for the database, UI, image service, and the main assisted service. ```yaml apiVersion: v1 kind: ConfigMap metadata: name: config data: ASSISTED_SERVICE_HOST: 192.168.0.141:8090 ASSISTED_SERVICE_SCHEME: http AUTH_TYPE: none DB_HOST: 127.0.0.1 DB_NAME: installer DB_PASS: admin DB_PORT: "5432" DB_USER: admin DEPLOY_TARGET: onprem DISK_ENCRYPTION_SUPPORT: "true" DUMMY_IGNITION: "false" ENABLE_SINGLE_NODE_DNSMASQ: "true" HW_VALIDATOR_REQUIREMENTS: '[{"version":"default","master":{"cpu_cores":4,"ram_mib":16384,"disk_size_gb":100,"installation_disk_speed_threshold_ms":10,"network_latency_threshold_ms":100,"packet_loss_percentage":0},"worker":{"cpu_cores":2,"ram_mib":8192,"disk_size_gb":100,"installation_disk_speed_threshold_ms":10,"network_latency_threshold_ms":1000,"packet_loss_percentage":10},"sno":{"cpu_cores":8,"ram_mib":16384,"disk_size_gb":100,"installation_disk_speed_threshold_ms":10},"edge-worker":{"cpu_cores":2,"ram_mib":8192,"disk_size_gb":15,"installation_disk_speed_threshold_ms":10}}]' IMAGE_SERVICE_BASE_URL: http://192.168.0.141:8888 IPV6_SUPPORT: "true" ISO_IMAGE_TYPE: "full-iso" LISTEN_PORT: "8888" NTP_DEFAULT_SERVER: "" POSTGRESQL_DATABASE: installer POSTGRESQL_PASSWORD: admin POSTGRESQL_USER: admin PUBLIC_CONTAINER_REGISTRIES: 'quay.io' SERVICE_BASE_URL: http://192.168.0.141:8090 STORAGE: filesystem OS_IMAGES: '[{"openshift_version":"4.12","cpu_architecture":"x86_64","url":"https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/37.20221127.3.0/x86_64/fedora-coreos-37.20221127.3.0-live.x86_64.iso","version":"37.20221127.3.0"},{"openshift_version":"4.12-scos","cpu_architecture":"x86_64","url":"https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/37.20221127.3.0/x86_64/fedora-coreos-37.20221127.3.0-live.x86_64.iso","version":"37.20221127.3.0"}]' RELEASE_IMAGES: '[{"openshift_version":"4.12","cpu_architecture":"x86_64","cpu_architectures":["x86_64"],"url":"quay.io/openshift/okd:4.12.0-0.okd-2023-04-01-051724","version":"4.12.0-0.okd-2023-04-01-051724","default":true},{"openshift_version":"4.12-scos","cpu_architecture":"x86_64","cpu_architectures":["x86_64"],"url":"quay.io/okd/scos-release:4.12.0-0.okd-scos-2023-03-23-213604","version":"4.12.0-0.okd-scos-2023-03-23-213604","default":false}]' ENABLE_UPGRADE_AGENT: "false" --- apiVersion: v1 kind: Pod metadata: labels: app: assisted-installer name: assisted-installer spec: containers: - args: - run-postgresql image: quay.io/centos7/postgresql-12-centos7:latest name: db envFrom: - configMapRef: name: config - image: quay.io/edge-infrastructure/assisted-installer-ui:latest name: ui ports: - hostPort: 8080 envFrom: - configMapRef: name: config - image: quay.io/edge-infrastructure/assisted-image-service:latest name: image-service ports: - hostPort: 8888 envFrom: - configMapRef: name: config - image: quay.io/edge-infrastructure/assisted-service:latest name: service ports: - hostPort: 8090 envFrom: - configMapRef: name: config restartPolicy: Never ``` -------------------------------- ### Configure Apache for OKD Ignition Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/virt-baremetal-upi/index.md Configures Apache to serve on ports 8080/8443 for OKD ignition configurations. It installs httpd, modifies listen ports, enables SELinux context for reading user content, enables and starts the httpd service, and opens the ports in the firewall. ```bash dnf install -y httpd sed -i 's/Listen 80/Listen 8080/' /etc/httpd/conf/httpd.conf sed -i 's/Listen 443/Listen 8443/' /etc/httpd/conf.d/ssl.conf setsebool -P httpd_read_user_content 1 systemctl enable --now httpd.service firewall-cmd --permanent --add-port=8080/tcp firewall-cmd --permanent --add-port=8443/tcp firewall-cmd --reload # Verify it’s up: curl localhost:8080 ``` -------------------------------- ### Copy HAProxy Configuration Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/upi-sno.md Copies a pre-defined HAProxy configuration file from a local path to the default HAProxy configuration directory. This assumes the configuration file is located in the 'openshift-vm-install' directory in the user's home folder. ```bash cp ~/openshift-vm-install/haproxy.cfg /etc/haproxy/haproxy.cfg ``` -------------------------------- ### HAProxy Configuration Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/vsphere-prereqs.md This is a sample HAProxy configuration file ('haproxy.cfg') defining global settings, logging, user/group permissions, SSL defaults, and default proxy settings including timeouts and error files. ```text global log /dev/log local0 log /dev/log local1 notice chroot /var/lib/haproxy stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners stats timeout 30s user haproxy group haproxy # Default SSL material locations ca-base /etc/ssl/certs crt-base /etc/ssl/private # Default ciphers to use on SSL-enabled listening sockets. # For more information, see ciphers(1SSL). This list is from: # https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/ # An alternative list with additional directives can be obtained from # https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=haproxy ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS ssl-default-bind-options no-sslv3 defaults log global mode http option httplog option dontlognull timeout connect 20000 timeout client 10000 timeout server 10000 errorfile 400 /etc/haproxy/errors/400.http errorfile 403 /etc/haproxy/errors/403.http errorfile 408 /etc/haproxy/errors/408.http errorfile 500 /etc/haproxy/errors/500.http errorfile 502 /etc/haproxy/errors/502.http errorfile 503 /etc/haproxy/errors/503.http errorfile 504 /etc/haproxy/errors/504.http # You can see the stats and observe OKD's bootstrap process by opening ``` -------------------------------- ### Create information boxes using Admonition Markdown Source: https://github.com/okd-project/okd-web/blob/main/docs/community/wg_docs/content.md Shows the basic syntax for creating information boxes (admonitions) using the `!!!` prefix in Markdown. The example demonstrates a standard note box. ```markdown !!! note This is a note ``` -------------------------------- ### Markdown Syntax Examples Source: https://github.com/okd-project/okd-web/blob/main/docs/community/wg_docs/content.md Illustrates common Markdown syntax for headings, bold, italic, inline code, fenced code blocks, ordered lists, unordered lists, and horizontal rules. ```Markdown # Title **text** *text* `code` ```shell ... ``` 1. list item - unordered list item --- ``` -------------------------------- ### Configure HAProxy for OKD Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/virt-baremetal-upi/index.md Installs HAProxy and configures firewall rules to allow necessary ports for OKD cluster communication. It also sets the HAProxy SELinux boolean to allow connections to any network resource. ```bash dnf install haproxy -y firewall-cmd --permanent --add-port=6443/tcp firewall-cmd --permanent --add-port=22623/tcp firewall-cmd --permanent --add-service=http firewall-cmd --permanent --add-service=https firewall-cmd --reload setsebool -P haproxy_connect_any 1 systemctl enable --now haproxy.service ``` -------------------------------- ### Inline Code Example Source: https://github.com/okd-project/okd-web/blob/main/docs/community/wg_docs/content.md Demonstrates how to use single backticks to enclose inline code, such as commands, for display within text. ```markdown To use inline you simply enclose the text using a single back quote **`** character. So a command can be included using **`oc get pods`** and will create `oc get pods` ``` -------------------------------- ### Markdown Indentation Example Source: https://github.com/okd-project/okd-web/blob/main/docs/community/wg_docs/content.md Demonstrates correct indentation in Markdown for nested lists and image alignment within ordered lists. ```Markdown 1. Ubiquity EdgeRouter ER-X - runs DHCP (embedded), custom DNS server via AdGuard ![pic](./img/erx.jpg){width=80%} ``` -------------------------------- ### Initialize Podman Machine on macOS Source: https://github.com/okd-project/okd-web/blob/main/docs/community/wg_docs/doc-env.md Initializes the Podman virtual machine on macOS, specifying resources (CPU, disk, memory) and mounting essential user directories for access within the VM. This command ensures that directories like /Users, /private, and /var/folders are available inside the Podman environment, facilitating access to your project files. ```shell podman machine init --cpus 6 --disk-size 150 -m 8096 --now -v /Users:/Users -v /private:/private -v /var/folders:/var/folders ``` -------------------------------- ### Serve okd.io Website Locally (npm scripts) Source: https://github.com/okd-project/okd-web/blob/main/docs/community/wg_docs/doc-env.md npm scripts to serve the okd.io website locally using Docker or Podman. These scripts abstract the underlying Docker/Podman commands for easier execution. ```shell npm run docker-serve ``` ```shell npm run win-docker-serve ``` ```shell npm run podman-serve ``` -------------------------------- ### OKD 4 DNS Zone File Configuration Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/vsphere-prereqs.md This is a sample BIND zone file for 'c1.homelab.net', defining A and AAAA records for cluster nodes, a load balancer, and wildcard DNS entries for applications. It includes SOA, NS, and A/AAAA records for various cluster components. ```text ; ; BIND data file for local loopback interface ; $TTL 604800 @ IN SOA c1.homelab.net. root.c1.homelab.net. ( 2 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS c1.homelab.net. @ IN A 192.168.178.5 @ IN AAAA ::1 load-balancer IN A 192.168.178.5 bootstrap IN A 192.168.178.200 master0 IN A 192.168.178.210 master1 IN A 192.168.178.211 master2 IN A 192.168.178.212 worker0 IN A 192.168.178.220 worker1 IN A 192.168.178.221 worker2 IN A 192.168.178.222 worker3 IN A 192.168.178.223 *.apps.c1.homelab.net. IN CNAME load-balancer.c1.homelab.net. api-int.c1.homelab.net. IN CNAME load-balancer.c1.homelab.net. api.c1.homelab.net. IN CNAME load-balancer.c1.homelab.net. ``` -------------------------------- ### Serve okd.io Website Locally (Docker/Podman) Source: https://github.com/okd-project/okd-web/blob/main/docs/community/wg_docs/doc-env.md Commands to serve the okd.io website locally using Docker or Podman. These commands mount the current directory to a container, exposing the site on port 8000. Changes to local files are reflected automatically. Use Ctrl-c to stop. ```shell podman run -it --rm --name mkdocs-serve -p 8000:8000 -v `pwd`:/site mkdocs-build ``` ```powershell docker run -it --rm --name mkdocs-build -p 8000:8000 -v "$(pwd):/site" mkdocs-build ``` ```cmd docker run -it --rm --name mkdocs-build -p 8000:8000 -v %cd%:/site mkdocs-build ``` -------------------------------- ### Build MkDocs Container Image Source: https://github.com/okd-project/okd-web/blob/main/docs/community/wg_docs/doc-env.md Builds a Docker or Podman container image named 'mkdocs-build' using the provided Dockerfile. This image is used to run MkDocs and serve the documentation locally. The command should be executed from the root directory of your local Git clone. ```shell docker build -t mkdocs-build -f ./dev/Dockerfile . podman build -t mkdocs-build -f ./dev/Dockerfile . # Using npm scripts: npm run docker-build-image npm run podman-build-image ``` -------------------------------- ### Building OKD Payloads with Tekton - `build-from-scratch.yaml` Source: https://github.com/okd-project/okd-web/blob/main/blog/2022/12-12-building-OKD-payload.md This example demonstrates a Tekton pipeline configuration for building OKD payloads from scratch. It outlines three main tasks: building the base and builder images, building payload images in batches, and finally, creating the OKD release image using `oc adm release new`. ```yaml pipeline: tasks: - name: build-base-and-builder taskRef: name: build-base-and-builder-task - name: build-payload-images-batch1 taskRef: name: build-payload-images-task runAfter: [build-base-and-builder] - name: build-payload-images-batch2 taskRef: name: build-payload-images-task runAfter: [build-payload-images-batch1] - name: build-release-image taskRef: name: build-release-image-task runAfter: [build-payload-images-batch2] params: - name: release_name value: "$(tasks.build-base-and-builder.results.releaseName)" - name: payload_images_ref value: "$(tasks.build-payload-images-batch2.results.payloadImagesRef)" ``` -------------------------------- ### Build and Validate okd.io Site (Docker/Podman) Source: https://github.com/okd-project/okd-web/blob/main/docs/community/wg_docs/doc-env.md Commands to build and validate the okd.io website using Docker or Podman. These commands mount the current directory and execute a build script, checking for spelling mistakes and broken links. The output should indicate zero issues found. ```shell docker run -it --rm --name mkdocs-build -p -v `pwd`:/site --entrypoint /site/build.sh mkdocs-build ``` ```shell podman run -it --rm --name mkdocs-build -p -v `pwd`:/site --entrypoint /site/build.sh mkdocs-build ``` ```powershell docker run -it --rm --name mkdocs-build -v "$(pwd):/site" --entrypoint /site/build.sh mkdocs-build ``` ```cmd docker run -it --rm --name mkdocs-build -v %cd%:/site --entrypoint /site/build.sh mkdocs-build ``` -------------------------------- ### Test DNS Resolution Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/upi-sno.md This section emphasizes the importance of verifying DNS resolution after configuring dnsmasq. Incorrect DNS settings, such as failure to resolve hostnames or perform reverse lookups, can lead to issues with cluster operations like bootstrapping. Specific examples of hostnames to check are provided. ```bash # Test that your DNS setup is working correctly # N.B. It's important to verify that dns works, I found that for example if api-int.lab.okd.lan didn’t resolve (also with reverse lookup) I had problems with bootstrap failing. ``` -------------------------------- ### Build Static Site Source: https://github.com/okd-project/okd-web/blob/main/docs/community/wg_docs/doc-env.md Generates or updates the static HTML website files in the 'public' directory. This is the output that will be published. ```shell mkdocs build ``` -------------------------------- ### Install ISC DHCP Server Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/vsphere-prereqs.md Installs the ISC DHCP server package on Debian-based systems, which will be used to manage IP address assignments in the local network. ```shell sudo apt-get install isc-dhcp-server ``` -------------------------------- ### Build and Validate okd.io Site (npm scripts) Source: https://github.com/okd-project/okd-web/blob/main/docs/community/wg_docs/doc-env.md npm scripts to build and validate the okd.io website using Docker or Podman. These scripts automate the build and validation process, including spell checking and link validation. ```shell npm run docker-build ``` ```shell npm run win-docker-build ``` ```shell npm run podman-build ``` -------------------------------- ### dnsmasq Configuration for OKD Cluster Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/upi-sno.md This configuration file sets up dnsmasq for an OKD cluster, defining network interfaces, domain names, and host records for various cluster nodes and services. It includes directives for DHCP name matching and ignoring, as well as SRV records for etcd. This setup is crucial for proper cluster communication and was implemented to address a security vulnerability. ```dnsmasq # This fixes a security hole. see CERT Vulnerability VU#598349 #dhcp-name-match=set:wpad-ignore,wpad #dhcp-ignore-names=tag:wpad-ignore interface=eno1 domain=okd.lan expand-hosts address=/bootstrap.lab.okd.lan/192.168.122.253 host-record=bootstrap.lab.okd.lan,192.168.122.253 address=/okd-cp-1.lab.okd.lan/192.168.122.2 host-record=okd-cp-1.lab.okd.lan,192.168.122.2 address=/okd-cp-2.lab.okd.lan/192.168.122.3 host-record=okd-cp-2.lab.okd.lan,192.168.122.3 address=/okd-cp-3.lab.okd.lan/192.168.122.4 host-record=okd-cp-3.lab.okd.lan,192.168.122.4 address=/okd-w-1.lab.okd.lan/192.168.122.5 host-record=okd-w-1.lab.okd.lan,192.168.122.5 address=/okd-w-2.lab.okd.lan/192.168.122.6 host-record=okd-w-2.lab.okd.lan,192.168.122.6 address=/okd-w-3.lab.okd.lan/192.168.122.7 host-record=okd-w-3.lab.okd.lan,192.168.122.7 address=/api.lab.okd.lan/192.168.122.1 host-record=api.lab.okd.lan,192.168.122.1 address=/api-int.lab.okd.lan/192.168.122.1 host-record=api-int.lab.okd.lan,192.168.122.1 address=/etcd-0.lab.okd.lan/192.168.122.2 address=/etcd-1.lab.okd.lan/192.168.122.3 address=/etcd-2.lab.okd.lan/192.168.122.4 address=/.apps.lab.okd.lan/192.168.122.1 srv-host=_etcd-server-ssl._tcp,etcd-0.lab.okd.lan,2380 srv-host=_etcd-server-ssl._tcp,etcd-1.lab.okd.lan,2380 srv-host=_etcd-server-ssl._tcp,etcd-2.lab.okd.lan,2380 address=/oauth-openshift.apps.lab.okd.lan/192.168.122.1 address=/console-openshift-console.apps.lab.okd.lan/192.168.122.1 ``` -------------------------------- ### Execute Build Script for OKD Project Source: https://github.com/okd-project/okd-web/blob/main/docs/community/wg_docs/doc-env.md This script performs a series of checks and builds for the OKD project. It includes spell checking, site building, and running a link checker, streamlining the validation process before submission. ```shell ./build.sh ``` -------------------------------- ### Configure SELinux for Container Mounting (Linux) Source: https://github.com/okd-project/okd-web/blob/main/docs/community/wg_docs/doc-env.md Configures SELinux on Linux to allow a local directory containing a Git repository to be mounted inside a container. This is crucial for SELinux-enabled systems to ensure that containerized tools can access project files. Replace '/home/brian/Documents/projects/okd.io' with the actual path to your OKD.io directory. ```shell sudo semanage fcontext -a -t container_file_t '/home/brian/Documents/projects/okd.io(/.*)?' sudo restorecon -Rv /home/brian/Documents/projects/okd.io ``` -------------------------------- ### Configure Schedulability for Control Plane Nodes Source: https://github.com/okd-project/okd-web/blob/main/docs/project/guides/upi-sno.md Modifies the cluster scheduler configuration to control whether control plane nodes can schedule workloads. This is often necessary for Single Node OpenShift (SNO) installations. ```shell `sed -i 's/mastersSchedulable: true/mastersSchedulable: false/' ~/okd-install/manifests/cluster-scheduler-02-config.yml` ``` -------------------------------- ### Build OKD Documentation Locally with Podman Source: https://github.com/okd-project/okd-web/blob/main/docs/documentation/index.md This command builds the OKD documentation locally using Podman. It mounts the current directory to the container and uses the asciibinder tool to perform the build. The output will be located in the `_preview` directory. ```shell podman run --rm -it -v `pwd`:/docs:Z quay.io/openshift-cs/asciibinder asciibinder build --distro openshift-origin ```