To store data in Azure blob storage you must use an existing container. Edit the spec.storage
section in the example azure-blob-storage.yaml
file below.
apiVersion: metering.openshift.io/v1
kind: MeteringConfig
metadata:
name: "operator-metering"
spec:
storage:
type: "hive"
hive:
type: "azure"
azure:
container: "bucket1" (1)
secretName: "my-azure-secret" (2)
rootDirectory: "/testDir" (3)
-
Specify the container name.
-
Specify a secret in the metering namespace. See the examples that follow for more details.
-
You can optionally specify the directory where you would like to store your data.
Use the example secret below as a template.
apiVersion: v1
kind: Secret
metadata:
name: your-azure-secret
data:
azure-storage-account-name: "dGVzdAo="
azure-secret-access-key: "c2VjcmV0Cg=="
You can use the following command to create the secret.
oc create secret -n openshift-metering generic your-azure-secret --from-literal=azure-storage-account-name=your-storage-account-name --from-literal=azure-secret-access-key-your-secret-key