Create a manifest for the F5 Artifact Registry pull secret

Introduction

To install F5 Lifecycle Operator (FLO) and BIG-IP Next for Kubernetes, your cluster must pull container images from F5 Artifact Registry (FAR).

Create the manifest

  1. Create a file to use as a script that creates a manifest for the F5 Artifact Registry pull secret:

    touch create-far-pull-secret-manifest.sh
    
  2. Open the file in a text editor.

  3. Copy the following code and paste it into the file:

    #!/usr/bin/env bash
    set -euo pipefail
    
    # Path to the FAR service account key JSON file
    KEY_FILE="cne_pull_64.json"
    
    if [[ ! -f "$KEY_FILE" ]]; then
      echo "ERROR: Service account key file not found: $KEY_FILE" >&2
      exit 1
    fi
    
    # Read the service account key JSON
    SERVICE_ACCOUNT_KEY="$(cat "$KEY_FILE")"
    
    # FAR expects "_json_key_base64:<key>" to be base64-encoded as the auth value
    SERVICE_ACCOUNT_K8S_SECRET="$(printf "%s" "_json_key_base64:${SERVICE_ACCOUNT_KEY}" | base64 -w 0)"
    
    # Build the dockerconfigjson content and base64-encode it for the Secret
    DOCKERCONFIG_JSON_B64="$(
      printf '%s' "{\"auths\":{\"repo.f5.com\":{\"auth\":\"${SERVICE_ACCOUNT_K8S_SECRET}\"}}}" | base64 -w 0
    )"
    
    # Write the Kubernetes secret manifest
    cat > far-pull-secret.yaml <<EOF
    apiVersion: v1
    kind: Secret
    metadata:
      name: far-pull-secret
    type: kubernetes.io/dockerconfigjson
    data:
      .dockerconfigjson: ${DOCKERCONFIG_JSON_B64}
    EOF
    
    echo "Generated: far-pull-secret.yaml"
    

    Note

    • The script assumes the service-account-key file is named cne_pull_64.json and is in the current directory.

    • On Linux, the script uses base64 -w 0 to prevent line wrapping.

    • On macOS, remove the -w 0 option from the base64 commands because macOS base64 does not support it.

  4. Save and close the file.

  5. Make the file executable:

    chmod +x create-far-pull-secret-manifest.sh
    
  6. Run the script:

    ./create-far-pull-secret-manifest.sh cne_pull_64.json
    

    The script creates a file named far-pull-secret.yaml.