### Fedora CoreOS RPM-OSTree Status Example Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/libvirt/libvirt.md Example output of `rpm-ostree status` after Fedora CoreOS installation and pivot. Shows the current deployment and its version. ```bash [core@okd4m0 ~]$ rpm-ostree status State: idle AutomaticUpdates: disabled Deployments: ● pivot://quay.io/openshift/okd-content@sha256:830ede6ea29c7b3e227261e4b2f098cbe2c98a344b2b54f3f05bb011e56b0209 CustomOrigin: Managed by machine-config-operator Timestamp: 2019-11-15T18:25:12Z ostree://fedora:fedora/x86_64/coreos/testing Version: 31.20191217.2.0 (2019-12-18T14:11:27Z) Commit: fd3a3a1549de2bb9031f0767d10d2302c178dec09203a1db146e0ad28f38c498 GPGSignature: Valid signature by 7D22D5867F2A4236474BF7B850CB390B3C3359C4 ``` -------------------------------- ### Start OKD 4 Cluster Installation Source: https://github.com/okd-project/okd/blob/master/Guides/IPI/azure/README.md Initiate the OKD 4 cluster installation process using the openshift-install command. This command starts the deployment on Azure. ```bash openshift-install create cluster ``` -------------------------------- ### OpenShift Install Configuration Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/libvirt/libvirt.md Example install-config.yaml file for OpenShift installation. Customize with your domain, cluster name, pull secret, and SSH public key. ```yaml --- apiVersion: v1 baseDomain: YOUR_DOMAIN compute: - hyperthreading: Enabled name: worker replicas: 0 controlPlane: hyperthreading: Enabled name: master replicas: 3 metadata: name: CLUSTER_NAME networking: clusterNetwork: - cidr: 10.100.0.0/14 hostPrefix: 23 networkType: OpenShiftSDN serviceNetwork: - 172.30.0.0/16 platform: none: {} pullSecret: 'SECRET FROM RED HAT CLUSTER MANAGER' sshKey: 'YOUR SSH PUBLIC KEY' ``` -------------------------------- ### Get Installer Image and Run Installation Container Source: https://github.com/okd-project/okd/blob/master/FAQ.md This command retrieves the installer image for a specific OKD release. The installer container can then be run using Podman or Docker to perform installation tasks, such as creating ignition configurations. ```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 ``` -------------------------------- ### Install Bind/named Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/vSphere_govc/Requirements/DNS_Bind.md Installs the Bind DNS server package using yum. This is the initial step for setting up a DNS service. ```bash $ sudo yum install bind ``` -------------------------------- ### Example `okd-set-node-ip.sh` Script Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/baremetal/nodes-custom-ip.md This script resolves the node's hostname to its IP address and configures Kubelet and CRIO environment variables. It's intended for use in bare metal OKD setups requiring custom IP configurations. ```sh #!/bin/bash HOSTNAME_RESOLVED_IP=$(hostname --ip-address | sed s/"//g) printf "[Service]\nEnvironment=\"KUBELET_NODE_IP=${HOSTNAME_RESOLVED_IP}\"\n" > /etc/systemd/system/kubelet.service.d/20-nodenet.conf printf "[Service]\nEnvironment=\"CONTAINER_STREAM_ADDRESS=${HOSTNAME_RESOLVED_IP}\"\n" > /etc/systemd/system/crio.service.d/20-nodenet.conf ``` -------------------------------- ### Start and Enable named Service Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/vSphere_govc/Requirements/DNS_Bind.md Starts the named (Bind) service and configures it to start automatically on system boot. This command activates the DNS server after configuration. ```bash $ sudo systemctl enable --now named ``` -------------------------------- ### Start HAProxy Service Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/vSphere_govc/Requirements/LB_HAProxy.md Use this command to start the HAProxy service after SELinux has been configured to allow it to bind to non-standard ports. ```bash $ sudo systemctl start haproxy ``` -------------------------------- ### Install HAProxy Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/vSphere_govc/Requirements/LB_HAProxy.md Installs the HAProxy package using yum. This is the initial step for setting up HAProxy on CentOS 7. ```bash $ sudo yum install haproxy ``` -------------------------------- ### Monitor OKD Installation with oc Source: https://github.com/okd-project/okd/blob/master/Guides/IPI/azure/README.md Set the KUBECONFIG environment variable and use the 'watch' command to monitor the OKD cluster version status in real-time. This helps track the installation progress. ```bash export KUBECONFIG=auth/kubeconfig watch -n 1 oc get clusterversion/version ``` -------------------------------- ### Check OKD Bootstrap Completion with Installer Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/libvirt/libvirt.md Use the OpenShift installer to monitor the bootstrap process. This command waits for the bootstrap to complete and logs debug information. ```bash $ openshift-installer wait-for bootstrap-complete --log-level debug ``` -------------------------------- ### Wait for Installation Completion Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/libvirt/libvirt.md Waits for the OKD installation to complete by monitoring the `install-complete` event. The `--log-level debug` flag provides detailed output during the process. ```bash $ openshift-install wait-for install-complete --log-level debug ``` -------------------------------- ### Libvirt Network Management Commands Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/libvirt/libvirt.md Commands to destroy and start a libvirt network. Ensure the network name matches your configuration. ```bash virsh# net-destroy openshift virsh# net-start openshift ``` -------------------------------- ### Get Installer Commit Hash Source: https://github.com/okd-project/okd/blob/master/troubleshooting/log-bundle.md Use this command to retrieve the specific commit hash of the installer used to build a release. This helps verify version consistency. ```bash $ oc adm release info registry.ci.openshift.org/origin/release:4.8 --commits | grep installer baremetal-installer https://github.com/vrutkovs/installer 4b15f0537ad76206c8ba9ba042b404f8c00a295a installer https://github.com/vrutkovs/installer 4b15f0537ad76206c8ba9ba042b404f8c00a295a installer-artifacts https://github.com/vrutkovs/installer 4b15f0537ad76206c8ba9ba042b404f8c00a295a ``` -------------------------------- ### Wait for OKD Cluster Installation to Complete Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/okd4-terraform-openstack/README.md Execute this command to wait for the OKD cluster installation to be fully completed and retrieve login information. ```bash ./openshift-install --dir=installer/ wait-for install-complete ``` -------------------------------- ### Optional Base64 Content for Static DNS Servers Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/baremetal/manual-dns-and-fcos-dns-fix.md This is an example of the content for the `75-static-dns-servers.conf` file, used for statically configuring DNS servers. DHCP DNS will still be appended and used if static DNS fails. ```text [Resolve] DNS=9.9.9.9 ``` -------------------------------- ### Update Installer and Image Script Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/okd4-terraform-openstack/README.md Fetches dependencies and deploys the cluster. Requires authentication to the OpenStack project for uploading the FCOS image. ```bash ./scripts/update-installer-and-image.sh 4.4.0-0.okd-2020-04-21-163702-beta4 31.20200420.20 ``` -------------------------------- ### Extract Installer from a Release Source: https://github.com/okd-project/okd/blob/master/CONTRIBUTING.md Extract a specific command-line tool, like `openshift-install`, from a release image. This command allows you to specify the desired operating system architecture. ```bash $ oc adm release extract --command='/usr/bin/openshift-install' --command-os=linux/arm64 quay.io/vrutkovs/okd-release:4.4-updated-prometheus ``` -------------------------------- ### Extracting openshift-install Tool Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/vSphere_terraform/README.md This command extracts the 'openshift-install' binary from a specified OpenShift release image. Ensure you have the correct release image URL and the 'oc' client installed. ```bash oc adm release extract --command=openshift-install registry.ci.openshift.org/origin/release:4.4.0-0.okd-2020-02-28-084836 ``` -------------------------------- ### Collect Cluster Data for Post-Installation Issues Source: https://github.com/okd-project/okd/blob/master/FAQ.md Use this command to gather cluster data when experiencing problems after installation. The output should be uploaded for developers. ```bash oc adm must-gather ``` -------------------------------- ### Generate Ignition Configuration Files Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/libvirt/libvirt.md Command to initiate the generation of Ignition configuration files using the OpenShift installer. ```bash $ openshift-install create ignition-configs ``` -------------------------------- ### Inspect Installer Manifests ConfigMap Source: https://github.com/okd-project/okd/blob/master/troubleshooting/log-bundle.md View the contents of the openshift-install-manifests ConfigMap to check the invoker and version details recorded during cluster installation. ```yaml apiVersion: v1 data: invoker: openshift-internal-ci/release-openshift-okd-installer-e2e-aws-upgrade/1396004378611027968 version: unreleased-master-4619-g4b15f0537ad76206c8ba9ba042b404f8c00a295a kind: ConfigMap metadata: creationTimestamp: null name: openshift-install-manifests namespace: openshift-config ``` -------------------------------- ### Print Fedora CoreOS Stream JSON Source: https://github.com/okd-project/okd/blob/master/FAQ.md Use the openshift-install command to retrieve information about tested Fedora CoreOS artifacts. This command helps identify compatible versions for your OKD installation. ```bash $ openshift-install coreos print-stream-json ``` -------------------------------- ### OKD Cluster Install Configuration Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/vSphere_govc/README.md Define the cluster configuration in install-config.yaml for a user-provisioned vSphere installation. This includes base domain, cluster name, node counts, platform details, pull secret, and SSH key. ```yaml apiVersion: v1 baseDomain: domain.tld metadata: name: cluster compute: - hyperthreading: Enabled name: worker replicas: 3 controlPlane: hyperthreading: Enabled name: master replicas: 3 platform: none: {} pullSecret: '' sshKey: ``` -------------------------------- ### Create OKD Cluster Source: https://github.com/okd-project/okd/blob/master/COMMUNITY-TESTING.md Initiates the creation of an OKD cluster for cloud-based installations. You may be prompted for a pull-secret. ```bash $ openshift-install create cluster ``` -------------------------------- ### OpenShift Install Configuration for vSphere Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/vSphere_terraform/README.md This YAML file defines the cluster's configuration, including compute, control plane, networking, and vSphere platform specifics. Ensure all placeholder values are replaced with your environment's details. ```yaml apiVersion: v1 baseDomain: YOUR_BASE_DOMAIN compute: - name: worker replicas: 3 controlPlane: name: master replicas: 3 metadata: name: YOUR_CLUSTER_ID networking: clusterNetworks: - cidr: 10.128.0.0/14 hostPrefix: 23 networkType: OpenShiftSDN serviceNetwork: - 172.30.0.0/16 platform: vsphere: vcenter: 'vcenterocp.example.com' username: 'YOUR_VSPHERE_USER' password: 'YOUR_VSPHERE_PASSWORD' datacenter: 'OCP-Datacenter' defaultDatastore: 'iscsi-hdd' pullSecret: '{"auths":{"fake":{"auth":"aWQ6cGFzcwo="}}}' sshKey: 'YOUR_SSH_KEY' ``` -------------------------------- ### Mirror Release Payload Images Source: https://github.com/okd-project/okd/blob/master/CONTRIBUTING.md Mirrors images from an external release payload to a local registry and creates a new release image. This is essential for air-gapped or restricted network installations. ```bash oc adm -a /path/to/pull-secret.json \ release mirror \ --from "registry.ci.openshift.org/origin/release:4.4.0-0.okd-2020-03-13-053843" \ --to quay.io/vrutkovs/okd-content \ --to-release-image quay.io/vrutkovs/okd-release:4.4 ``` -------------------------------- ### Create Main DNS Zone File Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/vSphere_govc/Requirements/DNS_Bind.md Defines the DNS records for the 'example.com' domain, including name servers, A records for cluster nodes, and SRV records for etcd. Placeholders for IPs and FQDNs need to be replaced. ```dns $TTL 604800 @ IN SOA ns1.example.com. admin.example.com. ( 1 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ; Negative Cache TTL ) ; name servers - NS records IN NS ns1 ; name servers - A records ns1.example.com. IN A BASTION_IP ; OpenShift Container Platform Cluster - A records BOOTSTRAP_SERVER_FQDN. IN A BOOTSTRAP_SERVER_IP CONTROL_PLANE_0_FQDN. IN A CONTROL_PLANE_0_IP CONTROL_PLANE_1_FQDN. IN A CONTROL_PLANE_1_IP CONTROL_PLANE_2_FQDN. IN A CONTROL_PLANE_2_IP COMPUTE_NODE_0_FQDN. IN A COMPUTE_NODE_0_IP COMPUTE_NODE_1_FQDN. IN A COMPUTE_NODE_1_IP ; OpenShift internal cluster IPs - A records api.CLUSTER_NAME.example.com. IN A BASTION_IP api-int.CLUSTER_NAME.example.com. IN A BASTION_IP *.apps.CLUSTER_NAME.example.com. IN A BASTION_IP etcd-0.CLUSTER_NAME.example.com. IN A CONTROL_PLANE_0_IP etcd-1.CLUSTER_NAME.example.com. IN A CONTROL_PLANE_1_IP etcd-2.CLUSTER_NAME.example.com. IN A CONTROL_PLANE_2_IP console-openshift-console.apps.CLUSTER_NAME.example.com. IN A BASTION_IP oauth-openshift.apps.CLUSTER_NAME.example.com. IN A BASTION_IP ; OpenShift internal cluster IPs - SRV records _etcd-server-ssl._tcp.CLUSTER_NAME.example.com. 86400 IN SRV 0 10 2380 etcd-0.CLUSTER_NAME _etcd-server-ssl._tcp.CLUSTER_NAME.example.com. 86400 IN SRV 0 10 2380 etcd-1.CLUSTER_NAME _etcd-server-ssl._tcp.CLUSTER_NAME.example.com. 86400 IN SRV 0 10 2380 etcd-2.CLUSTER_NAME ``` -------------------------------- ### Define DNS Zones in named.conf.local Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/vSphere_govc/Requirements/DNS_Bind.md Defines the forward zone for 'example.com' and the reverse zone for the '192.168.100.0/24' subnet. Specifies the master type and the location of the zone files. ```bash # cat /etc/named/named.conf.local zone "example.com" { type master; file "/var/named/zones/db.example.com"; # zone file path }; zone "100.168.192.in-addr.arpa" { type master; file "/var/named/zones/db.192.168.100"; # 192.168.100.0/24 subnet }; ``` -------------------------------- ### Download and Import Fedora CoreOS OVA Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/vSphere_govc/README.md Download the FCOS OVA image for VMware and import it into your vSphere datastore using the govc command. ```bash wget https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/31.20200113.3.1/x86_64/fedora-coreos-31.20200113.3.1-vmware.x86_64.ova # Import into vSphere govc import.ova -ds= \ -name fedora-coreos-31.20200113.3.1-vmware.x86_64 \ fedora-coreos-31.20200113.3.1-vmware.x86_64.ova ``` -------------------------------- ### Destroy OKD Cluster Source: https://github.com/okd-project/okd/blob/master/COMMUNITY-TESTING.md Removes an OKD cluster and any associated cloud resources created by the installer. Use this to clean up after testing. ```bash $ openshift-install destroy cluster ``` -------------------------------- ### Create FCOS VMs for OKD Cluster Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/vSphere_govc/README.md A bash script to iteratively create master, worker, and bootstrap FCOS virtual machines in vSphere using govc. Ensure template_name, cluster_name, datastore_name, vm_folder, network_name, master_node_count, and worker_node_count are set. ```bash #!/bin/bash # Title: UPI-vSphere-GenerateVMs # Description: This is an example bash script to create the VMs iteratively. Set the values for cluster_name, datastore_name, vm_folder, network_name, master_node_count, and worker_node_count. template_name="fedora-coreos-31.20200113.3.1-vmware.x86_64" cluster_name= datastore_name= vm_folder= network_name= master_node_count= worker_node_count= # Create the master nodes for (( i=1; i<=${master_node_count}; i++ )); do vm="${cluster_name}-master-${i}" govc vm.clone -vm "${template_name}" \ -ds "${datastore_name}" \ -folder "${vm_folder}" \ -on="false" \ -c="4" -m="8192" \ -net="${network_name}" \ $vm govc vm.disk.change -vm $vm -disk.label "Hard disk 1" -size 120G done # Create the worker nodes for (( i=1; i<=${worker_node_count}; i++ )); do vm="${cluster_name}-worker-${i}" govc vm.clone -vm "${template_name}" \ -ds "${datastore_name}" \ -folder "${vm_folder}" \ -on="false" \ -c="4" -m="8192" \ -net="${network_name}" \ $vm govc vm.disk.change -vm $vm -disk.label "Hard disk 1" -size 120G done # Create the bootstrap node vm="${cluster_name}-bootstrap" govc vm.clone -vm "${template_name}" \ -ds "${datastore_name}" \ -folder "${vm_folder}" \ -on="false" \ -c="4" -m="8192" \ -net="${network_name}" \ $vm govc vm.disk.change -vm $vm -disk.label "Hard disk 1" -size 120G ``` -------------------------------- ### Examine Release Image Download Logs Source: https://github.com/okd-project/okd/blob/master/troubleshooting/log-bundle.md Inspect the journal logs for the 'release-image-download.service' to verify the correct release payload was used during the bootstrap process. ```text -- Journal begins at Sat 2021-05-22 07:32:02 UTC, ends at Sat 2021-05-22 08:06:41 UTC. -- May 22 07:34:45 ip-10-0-6-51 systemd[1]: Starting Download the OpenShift Release Image... May 22 07:34:45 ip-10-0-6-51 release-image-download.sh[762]: Pulling registry.build01.ci.openshift.org/ci-op-fggt4c0x/release@sha256:c843adfb4bddd22f7256325ed387d9a685be451ca6d708a56ecb8e8a738b7892... May 22 07:34:46 ip-10-0-6-51 podman[813]: 2021-05-22 07:34:46.474241096 +0000 UTC m=+0.476275595 system refresh May 22 07:34:46 ip-10-0-6-51 podman[813]: 2021-05-22 07:34:46.807049267 +0000 UTC m=+0.809083790 image pull May 22 07:34:46 ip-10-0-6-51 release-image-download.sh[813]: cfd14e030756425d5f7b09f44926c50c87256f5dd75303f845c27e22790d423e May 22 07:34:46 ip-10-0-6-51 systemd[1]: Finished Download the OpenShift Release Image. ``` -------------------------------- ### Create Symlink for .cache Directory Source: https://github.com/okd-project/okd/blob/master/Guides/IPI/azure/README.md If insufficient space is available in your home directory, create a symlink for the .cache directory to a location with more storage. This is a workaround for limited Cloud Shell space. ```bash cd ~ mkdir /home/cache ln -s /home/cache /home/" }, "mode": 420 } ] } } ``` -------------------------------- ### Get Image Pullspecs for a Release Source: https://github.com/okd-project/okd/blob/master/CONTRIBUTING.md Use `oc adm release info` to retrieve the pullspec for a specific image within an existing release. This is useful for identifying the exact image reference before updating it. ```bash $ oc adm release info registry.ci.openshift.org/origin/release:4.4 --pullspecs | grep prometheus k8s-prometheus-adapter registry.ci.openshift.org/origin/4.4-2020-04-14-172428@sha256:12bac47c71cb7ef36b6ee7b78e0476fbfb8a67bbf61ac42c461c17c98ac850a6 prometheus registry.ci.openshift.org/origin/4.4-2020-04-14-172428@sha256:5af0373659974782379d90d9a174352dd8f85cb7327cc48ef36cae4e8ba5903f prometheus-alertmanager registry.ci.openshift.org/origin/4.4-2020-04-14-172428@sha256:25bed531ccb0ff16ce19b927265f03cb9b2d572caa224ef302002269e925d83c prometheus-config-reloader registry.ci.openshift.org/origin/4.4-2020-04-14-172428@sha256:deacbd618b3c037cc8c99a83db2c2a1053db517b0a0bfdfdeb309591559c3eea prometheus-node-exporter registry.ci.openshift.org/origin/4.4-2020-04-14-172428@sha256:c199e7353642ed1a4237416055a75b0e415034c7ec48bbc8ae8d12b72552f819 prometheus-operator registry.ci.openshift.org/origin/4.4-2020-04-14-172428@sha256:ec28b9dc5ad9184d0d70b85e5bc618c809084b293cbc57c215bf845bf7147b2b ``` -------------------------------- ### Configure SELinux for HAProxy Port Binding Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/vSphere_govc/Requirements/LB_HAProxy.md Allows HAProxy to connect to any port, which is necessary when it binds to non-standard ports like 6443 and 22623 for OKD services. The '-P' flag makes the change persistent across reboots. ```bash $ sudo setsebool -P haproxy_connect_any on ``` -------------------------------- ### MachineConfig for Custom Node IP Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/baremetal/nodes-custom-ip.md This MachineConfig defines a systemd service that runs a script to set a custom node IP. It ensures the script executes after the default node IP configuration but before Kubelet and CRI.O start. ```yaml apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig metadata: labels: machineconfiguration.openshift.io/role: master name: okd-configure-master-node-ip spec: config: ignition: version: 3.1.0 storage: files: - contents: # See below on writing your IP resolution script source: data:text/plain;charset=utf-8;base64, mode: 493 overwrite: true path: /usr/local/bin/okd-set-node-ip.sh systemd: units: - name: okd-node-ip.service enabled: true contents: | [Unit] Description=Overwrites the output of nodeip-configuration.service to replace with our result After=nodeip-configuration.service Before=kubelet.service crio.service [Service] Type=oneshot ExecStart=/usr/local/bin/okd-set-node-ip.sh [Install] RequiredBy=kubelet.service ``` -------------------------------- ### Configure named.conf.local Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/vSphere_govc/Requirements/DNS_Bind.md Adds a configuration file for local DNS zone definitions to the main named configuration. This file specifies the zones and their corresponding zone files. ```bash include "/etc/named/named.conf.local"; ``` -------------------------------- ### Worker Node MachineConfig Example Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/baremetal/nodes-custom-ip.md This YAML snippet defines a MachineConfig to target worker nodes, setting the `okd-configure-worker-node-ip` name. It's used to apply custom IP configurations to worker nodes in a multi-node cluster. ```yaml apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig metadata: labels: machineconfiguration.openshift.io/role: worker name: okd-configure-worker-node-ip spec: ... ``` -------------------------------- ### Initiate Cluster Upgrade to Latest Version Source: https://github.com/okd-project/okd/blob/master/FAQ.md This command upgrades the cluster to the latest available version. It respects the defined upgrade paths. ```bash oc adm upgrade ``` -------------------------------- ### Get Commit URLs for Release Images Source: https://github.com/okd-project/okd/blob/master/CONTRIBUTING.md Use `oc adm release info --commit-urls` to inspect the Git commit URLs used to build images within a release. This helps in tracing the origin of specific image components. ```bash $ oc adm release info registry.ci.openshift.org/origin/release:4.4 --commit-urls ... Images: NAME URL aws-machine-controllers https://github.com/openshift/cluster-api-provider-aws/commit/5fa82204468e71b44f65a5f24e2675dbfa0f5c29 azure-machine-controllers https://github.com/openshift/cluster-api-provider-azure/commit/832a43a30d7f00cd6774c1f5cd117aeebbe1b730 baremetal-installer https://github.com/openshift/installer/commit/e0b9dedd751543fbc01066a3049ff000e60b1459 ``` -------------------------------- ### Ignition Configuration for Hostname Resolution Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/baremetal/node-hostname-resolution.md This JSON configuration is merged into the `bootstrap.ign` file. It includes a script to resolve the node's hostname and a systemd service to execute the script and set the hostname during the first boot. The script's base64 encoded content needs to be injected into the `source` field. ```json { "storage": { "files": [ { "overwrite": true, "path": "/usr/local/bin/okd-resolve-node-hostname.sh", "user": { "name": "root" }, "contents": { "source": "data:text/plain;charset=utf-8;base64," }, "mode": 493 } ] }, "systemd": { "units": [ { "contents": "[Unit]\nDescription=Resolve and Set Node Hostname\n# Removal of this file signals firstboot completion\nConditionPathExists=!/etc/hostname\n# Block services relying on Networking being up.\nBefore=network-online.target\n# Wait for NetworkManager to report its online\nAfter=NetworkManager-wait-online.service\n# Run before hostname checks\nBefore=node-valid-hostname.service\n[Service]\nType=oneshot\nRemainAfterExit=yes\nExecStartPre=/usr/local/bin/okd-resolve-node-hostname.sh\nExecStart=/bin/bash -c \"hostnamectl set-hostname \`cat /run/okd-node-hostname\ `\"\n[Install]\n# This makes sure the systemd file is linked correctly\nWantedBy=network-online.target", "enabled": true, "name": "okd-configure-hostname.service" } ] } } ``` -------------------------------- ### Find Multi-Version Upgrade Path Source: https://github.com/okd-project/okd/blob/master/FAQ.md This command downloads a Python script and uses it with curl to find a complete upgrade path between two specified versions. It's useful when multiple jumps are required. ```sh wget -q https://gist.githubusercontent.com/Goose29/ca7debd6aec7d1a4959faa2d1b661d93/raw/4584d89c49d4af197480539bdd873f6d9ca2dd83/upgrade-path.py && (curl -sH 'Accept:application/json' 'https://amd64.origin.releases.ci.openshift.org/graph?channel=stable-4' | python ./upgrade-path.py 4.7.0-0.okd-2021-03-28-152009 4.13.0-0.okd-2023-09-30-084937) ``` -------------------------------- ### Create New Release with Updated Image Source: https://github.com/okd-project/okd/blob/master/CONTRIBUTING.md Use `oc adm release new` to create a new release based on an existing one, specifying image replacements. Ensure you provide the correct path to your pull secret. ```bash $ oc adm -a /path/to/pull_secret.json \ release new \ --from-release registry.ci.openshift.org/origin/release:4.4 \ --to-image quay.io/vrutkovs/okd-release:4.4-updated-prometheus \ prometheus=docker.io/prom/prometheus:v2.17.1 ``` -------------------------------- ### Bootstrap Ignition Configuration Snippet Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/baremetal/nodes-custom-ip.md This JSON snippet is designed to be merged into the `bootstrap.ign` file. It injects a script for setting node IPs and a systemd service to execute it, ensuring custom IP configurations are applied during the bootstrap phase. ```json { "storage": { "files": [ { "overwrite": true, "path": "/usr/local/bin/okd-set-node-ip.sh", "user": { "name": "root" }, "contents": { "source": "data:text/plain;charset=utf-8;base64," }, "mode": 493 } ] }, "systemd": { "units": [ { "contents": "[Unit]\nDescription=Overwrites the output of nodeip-configuration.service to replace with our result\nAfter=nodeip-configuration.service\nBefore=kubelet.service crio.service\n[Service]\nType=oneshot\nExecStart=/usr/local/bin/okd-set-node-ip.sh\n[Install]\nRequiredBy=kubelet.service", "enabled": true, "name": "okd-node-ip.service" } ] } } ``` -------------------------------- ### UPI-vSphere-AddMetadata Bash Script Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/vSphere_govc/README.md A bash script to iteratively set VM metadata for OKD cluster nodes using govc. It requires cluster name, master node count, and worker node count to be defined. ```bash #!/bin/bash # Title: UPI-vSphere-AddMetadata # Description: This is an example bash script to set the metadata on the VMs iteratively. Set the values for cluster_name, master_node_count, and worker_node_count. cluster_name= master_node_count= worker_node_count= # Set the metadata on the master nodes for (( i=1; i<=${master_node_count}; i++ )); do vm="${cluster_name}-master-${i}" govc vm.change -vm $vm \ -e guestinfo.ignition.config.data=\"$(cat master.ign | base64 -w0)\" \ -e guestinfo.ignition.config.data.encoding=\"base64\" \ -e disk.EnableUUID=\"TRUE\" done # Set the metadata on the worker nodes for (( i=1; i<=${worker_node_count}; i++ )); do vm="${cluster_name}-worker-${i}" govc vm.change -vm $vm \ -e guestinfo.ignition.config.data=\"$(cat worker.ign | base64 -w0)\" \ -e guestinfo.ignition.config.data.encoding=\"base64\" \ -e disk.EnableUUID=\"TRUE\" done # Set the metadata on the bootstrap node vm="${cluster_name}-bootstrap" govc vm.change -vm $vm \ -e guestinfo.ignition.config.data=\"$(cat append-bootstrap.ign | base64 -w0)\" \ -e guestinfo.ignition.config.data.encoding=\"base64\" \ -e disk.EnableUUID=\"TRUE\" ``` -------------------------------- ### Inspect OKD Release Contents and Commit IDs Source: https://github.com/okd-project/okd/blob/master/FAQ.md Use this command to view the metadata of a CI release, including component versions and their associated Git commit URLs. This is useful for verifying if specific commits are included in a release. ```bash oc adm release info registry.ci.openshift.org/origin/release:4.4 --commit-urls ``` ```text Name: 4.4.0-0.okd-2020-04-10-020541 Digest: sha256:79b82f237aad0c38b5cdaf386ce893ff86060a476a39a067b5178bb6451e713c Created: 2020-04-10T02:14:15Z OS/Arch: linux/amd64 Manifests: 413 Pull From: registry.ci.openshift.org/origin/release@sha256:79b82f237aad0c38b5cdaf386ce893ff86060a476a39a067b5178bb6451e713c Release Metadata: Version: 4.4.0-0.okd-2020-04-10-020541 Upgrades: Component Versions: kubernetes 1.17.1 machine-os 31.20200407.20 Fedora CoreOS Images: NAME URL aws-machine-controllers https://github.com/openshift/cluster-api-provider-aws/commit/5fa82204468e71b44f65a5f24e2675dbfa0f5c29 azure-machine-controllers https://github.com/openshift/cluster-api-provider-azure/commit/832a43a30d7f00cd6774c1f5cd117aeebbe1b730 baremetal-installer https://github.com/openshift/installer/commit/a58f24b0df7e3699b39d4ae1d23c45672706934d baremetal-machine-controllers baremetal-operator baremetal-runtimecfg https://github.com/openshift/baremetal-runtimecfg/commit/09850a724d9290ffb05db3dd7f4f4c748b982759 branding https://github.com/openshift/origin-branding/commit/068fa1eac9f31ffe13089dd3de2ec49c153b2a14 cli https://github.com/openshift/oc/commit/2576e482bf003e34e67ba3d69edcf5d411cfd6f3 cli-artifacts https://github.com/openshift/oc/commit/2576e482bf003e34e67ba3d69edcf5d411cfd6f3 cloud-credential-operator https://github.com/openshift/cloud-credential-operator/commit/446680ed10ac938e11626409acb0c076edd3fd52 ... ``` -------------------------------- ### Granting Root Access to Default Service Account Source: https://github.com/okd-project/okd/blob/master/README.md Use this command to allow the default service account in the current project to run containers as UID 0 (root). This is useful for containers that expect to run as root. ```bash # Gives the default service account in the current project access to run as UID 0 (root) oc adm policy add-scc-to-user anyuid -z default ``` -------------------------------- ### Configure Firewall for HAProxy Access Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/vSphere_govc/Requirements/LB_HAProxy.md These commands configure the firewall to allow access to specific ports (6443 for API, 22623 for MachineConfig) only from a defined internal subnet (LIBVIRT_OKD_SUBNET). The --permanent flag ensures the rules persist after a reload, and --reload applies the changes. ```bash $ sudo firewall-cmd --add-rich-rule='rule family="ipv4" source address="LIBVIRT_OKD_SUBNET" port port="6443" protocol="tcp" accept' --permanent $ sudo firewall-cmd --add-rich-rule='rule family="ipv4" source address="LIBVIRT_OKD_SUBNET" port port="22623" protocol="tcp" accept' --permanent $ sudo firewall-cmd --reload ``` -------------------------------- ### Render and Patch Kubernetes API Server Manifests Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/baremetal/nodes-custom-ip.md This script segment renders the Kubernetes API server manifests using the `cluster-kube-apiserver-operator` and then patches the generated configuration to include the resolved hostname IP address. It's crucial for setting up the API server with the correct network interface during bootstrap. ```bash if [ ! -f kube-apiserver-bootstrap.done ] then echo "Rendering Kubernetes API server core manifests..." rm --recursive --force kube-apiserver-bootstrap bootkube_podman_run \ --volume "$PWD:/assets:z" \ "${KUBE_APISERVER_OPERATOR_IMAGE}" \ /usr/bin/cluster-kube-apiserver-operator render \ --manifest-etcd-serving-ca=etcd-ca-bundle.crt \ --manifest-etcd-server-urls="${ETCD_ENDPOINTS}" \ --manifest-image="${OPENSHIFT_HYPERKUBE_IMAGE}" \ --manifest-operator-image="${KUBE_APISERVER_OPERATOR_IMAGE}" \ --asset-input-dir=/assets/tls \ --asset-output-dir=/assets/kube-apiserver-bootstrap \ --config-output-file=/assets/kube-apiserver-bootstrap/config \ --cluster-config-file=/assets/manifests/cluster-network-02-config.yml ### START PATCH - Modify rendered kube-apiserver-bootstrap config ### sed -E "s/apiServerArguments:/apiServerArguments:\n advertise-address:\n - ${HOSTNAME_RESOLVED_IP}/" kube-apiserver-bootstrap/config ### END PATCH - Modify rendered kube-apiserver-bootstrap config ### cp kube-apiserver-bootstrap/config /etc/kubernetes/bootstrap-configs/kube-apiserver-config.yaml cp kube-apiserver-bootstrap/bootstrap-manifests/* bootstrap-manifests/ cp kube-apiserver-bootstrap/manifests/* manifests/ touch kube-apiserver-bootstrap.done fi ``` -------------------------------- ### Base64 Content for Disabling DNS Stub Listener Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/baremetal/manual-dns-and-fcos-dns-fix.md This is the content for the `50-no-dns-stub.conf` file, which prevents systemd from creating a DNS stub listener symlink at runtime, thus negating the FCOS regression. ```text [Resolve] DNSStubListener=no ``` -------------------------------- ### Bootstrap Ignition Configuration Source: https://github.com/okd-project/okd/blob/master/Guides/UPI/vSphere_govc/README.md Defines the configuration for the bootstrap ignition file, specifying a source URL for the main bootstrap.ign file. ```json { "ignition": { "config": { "merge": [ { "source": "http://10.0.0.50:8000/bootstrap.ign", "verification": {} } ] }, "timeouts": {}, "version": "3.0.0" } } ```