# OKD Cluster Automation This repository contains Ansible automation for deploying and managing OKD clusters. The automation supports both initial cluster provisioning and day-2 operations. ## Directory Structure ``` ansible/ ├── inventories/ │ └── hub/ │ └── group_vars/ │ └── okd_cluster.yml # Cluster-specific variables ├── playbooks/ │ ├── provision_cluster.yml # Initial cluster deployment │ └── day2_operations.yml # Post-deployment configurations └── roles/ └── okd_install/ # OKD installation role ``` ## Prerequisites - Ansible 2.9 or higher - Python 3.6 or higher - `ansible-navigator` for container-based execution - Access to target machines with SSH key authentication - DNS configured for the cluster domain - Required network configuration (DHCP, load balancers, etc.) ## Configuration The cluster configuration is defined in `inventories/hub/group_vars/okd_cluster.yml`. Key configurations include: ```yaml # OKD cluster configuration okd_version: "4.17.0-okd-scos.0" base_domain: "okd.container.mom" okd_name: "hub" ``` ## Usage ### Initial Cluster Provisioning To provision a new cluster: ```bash # Make sure you're in the ansible directory cd ansible # Run the playbook ansible-playbook playbooks/provision_cluster.yml --inventory inventories/hub ``` This will: 1. Download and install OKD installation tools 2. Generate installation configurations 3. Create the cluster 4. Configure hybrid master nodes (control plane nodes are schedulable) ### Installation Process The installation process follows these steps: 1. **Prerequisites Check and Setup** - Verifies and installs required tools (openshift-install, oc) - Creates necessary directories 2. **Configuration Generation** - Creates install-config.yaml from template - Generates Kubernetes manifests - Creates Ignition configs 3. **Cluster Installation** - Initiates the cluster creation - Waits for bootstrap completion - Configures master nodes as schedulable (hybrid mode) - Waits for installation completion ## Available Tags - `prereq`: Install prerequisites - `config`: Generate configurations - `install`: Run the installation - `ignition`: Generate ignition configs ## Node Configuration The automation supports a hybrid node setup where master nodes are also workers: ```yaml # Node configuration okd_controller_replicas: 3 # 3 master nodes okd_worker_replicas: 0 # No dedicated workers okd_make_masters_schedulable: true # Hybrid mode # Current node configuration okd_masters: - name: master0 ip: "188.244.117.200" - name: master1 ip: "188.244.117.223" - name: master2 ip: "188.244.117.142" ``` ## Important Notes 1. **Role Path** - Ensure you run the playbook from the `ansible` directory - The roles directory must be at `ansible/roles` - Verify role path with: `ansible-config dump | grep ROLES_PATH` 2. **Installation Monitoring** - Monitor progress: `tail -f {{ okd_cluster_artifacts }}/.openshift_install.log` - Bootstrap node access: `ssh -o UserKnownHostsFile=/dev/null core@{{ okd_bootstrap_external_static_ip }}` 3. **Network Requirements** - Ensure VIPs are available - DNS must be properly configured - Network CIDR must be correctly set ## Troubleshooting Common issues and solutions: 1. **Role Not Found** ```bash # Fix by creating ansible.cfg in the ansible directory echo "[defaults] roles_path = ./roles" > ansible.cfg ``` 2. **Network Issues** - Verify VIP accessibility - Check DNS resolution - Confirm network CIDR is correct 3. **Node Access** - Verify SSH key authentication - Check network connectivity - Ensure proper permissions ## License This project is licensed under the MIT License.