Configure Job Permissions

Before deploying the key-generation job, you need to create specific roles and bindings that allow the job to create a Kubernetes Secret (which will store the generated SSL certificate).

This step ensures the key-generation job running in OpenShift has the necessary permissions to securely create and manage the SSL certificate secret used by your application pods.

1. Create a file named job-permissions.yaml in the path /home/admin/hsm-build/.

image-20251024-133845.png


Create job-permissions.yaml

  1. Paste the contents provided below and save the file.

    YAML
    apiVersion: rbac.authorization.k8s.io/v1
    kind: Role
    metadata:
      name: secret-creator
    rules:
    - apiGroups: [""]
      resources: ["secrets"]
      verbs: ["create", "get", "delete" , "patch"]
    ---
    apiVersion: v1
    kind: ServiceAccount
    metadata:
      name: key-generator-sa
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: RoleBinding
    metadata:
      name: secret-creator-binding
    subjects:
    - kind: ServiceAccount
      name: key-generator-sa
    roleRef:
      kind: Role
      name: secret-creator
      apiGroup: rbac.authorization.k8s.io
    
  2. Apply the configuration.

image-20251024-134249.png


Apply job-permissions.yaml

  1. Verify that the Role, ServiceAccount, and RoleBinding are created successfully.

image-20251024-134434.png


Verify Permissions