../../images/logo.svg

Maintenance script

Warning Use at your own risk (dangerous steps commented) #!/bin/bash set -e USE_SSH=false DRAINMODE="" while getopts ":sd:" opt; do case ${opt} in s ) USE_SSH=true echo "SSH mode enabled." ;; d ) DRAINMODE=$OPTARG echo "Drain mode set to: $DRAINMODE" ;; \? ) echo "Invalid option: $OPTARG" 1>&2 echo "Usage: $0 [-s] [-d DRAINMODE]" echo " -s Use SSH to reboot nodes instead of oc debug" echo " -d Set drain mode options (e.

Single Node Openshift running on OCP-V disconnected

LAB overview In this LAB, I’m going to deploy a single node OpenShift Cluster in Openshift Virtualization using a private network without internet access. 1. Requirements A linux machine with clients installed Openshift Client https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/stable/openshift-client-linux.tar.gz Openshift install client https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/4.17.16/openshift-install-linux.tar.gz oc mirror https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/latest/oc-mirror.rhel9.tar.gz virtctl (Get the downlond links from the Openshift Console) A mirror registry to store Openshift Images Mirror registry for Red Hat openshift will be used in this lab

Control allowed registries with Gatekeeper policies

Gatekeeper Operator Overview Install operator Create NS apiVersion: v1 kind: Namespace metadata: name: openshift-gatekeeper-system Create Subscription apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: gatekeeper-operator-product namespace: openshift-operators spec: channel: stable installPlanApproval: Automatic name: gatekeeper-operator-product source: redhat-operators sourceNamespace: openshift-marketplace startingCSV: gatekeeper-operator-product.v3.17.0Create OPA Gatekeeper instance kind: Gatekeeper apiVersion: operator.gatekeeper.sh/v1alpha1 metadata: name: gatekeeper spec: validatingWebhook: EnabledCreate tests resources Mirror a test image In this scenario I already mirrored an UBI9 image in my private repository, the image is avaialble at `quay.

Ansible Execution Environment Build Factory

Components overview Ansible Automation Platform Red Hat® Ansible® Automation Platform is an end-to-end automation platform to configure systems, deploy software, and orchestrate advanced workflows. It includes resources to create, manage, and scale across the entire enterprise. Execution Environements These are container images which include the operating system kernel (Red Hat Enterprise Linux® Universal Base Image), automation engine (ansible-core), programming language (Python), as well as all necessary dependencies. Together, they create an isolated execution environment that can interact with—and run on—almost any IT platform.

OCP etcd backup

How to schedule etcd backups using cronjob What you will need : Namespace Service Account Cluster Role Cluster Role Binding Extend SA priviliges Cronjob Namespace --- apiVersion: project.openshift.io/v1 kind: Project metadata: annotations: openshift.io/description: Openshift Backup Automation Tool openshift.io/display-name: Backup ETCD Automation name: ocp-etcd-backup finalizers: - kubernetesService Account --- kind: ServiceAccount apiVersion: v1 metadata: name: openshift-backup namespace: ocp-etcd-backup labels: app: openshift-backupCluster role --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: cluster-etcd-backup rules: - apiGroups: [""] resources: - "namespaces" verbs: ["get", "list", "create"] - apiGroups: [""] resources: - "nodes" verbs: ["get", "list"] - apiGroups: [""] resources: - "pods" - "pods/log" verbs: ["get", "list", "create", "delete", "watch"]Cluster Role Binding --- kind: ClusterRoleBinding apiVersion: rbac.

Configure OCP network using nmstate operator

Official documentation Install operator Create NS apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: annotations: olm.providedAPIs: NMState.v1.nmstate.io generateName: openshift-nmstate- name: openshift-nmstate-tn6k8 namespace: openshift-nmstate spec: targetNamespaces: - openshift-nmstateCreate operator group apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: annotations: olm.providedAPIs: NMState.v1.nmstate.io generateName: openshift-nmstate- name: openshift-nmstate-tn6k8 namespace: openshift-nmstate spec: targetNamespaces: - openshift-nmstateCreate sub apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: labels: operators.coreos.com/kubernetes-nmstate-operator.openshift-nmstate: "" name: kubernetes-nmstate-operator namespace: openshift-nmstate spec: channel: stable installPlanApproval: Automatic name: kubernetes-nmstate-operator source: redhat-operators sourceNamespace: openshift-marketplaceCreate nmstate instance apiVersion: nmstate.