As pointed out by @WillGordon's comments you can use oc create secret generic
, as shown in the example below:
$ cat config.json
{
"auths": {
"my-repo-location" : {
"auth": "ZTAxODE0W5V1yndNfoUdYWjRNtU="
}
}
}
$ oc create secret generic config --from-file=./config.json
secret/config created
$ oc get secret config -o yaml
apiVersion: v1
data:
config.json: ICAgIHsKICAgICAgICAiYXV0aHMiOiB7CiAgICAgICAgICAgICJteS1yZXBvLWxvY2F0aW9uIiA6IHsKICAgICAgICAgICAgICAgICJhdXRoIjogIlpUQXhPREUwVzVWMXluZE5mb1VkWVdqUk50VT0iCiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9Cg==
kind: Secret
metadata:
creationTimestamp: 2020-01-10T15:00:21Z
name: config
namespace: next
resourceVersion: "46478941"
selfLink: /api/v1/namespaces/next/secrets/config
uid: ec4a4538-33b9-11ea-a9de-005056b7c210
type: Opaque
$
However, if creating a secret for accessing a Docker registry you can use the docker-registry
option, as shown below:
oc create secret docker-registry SECRET_NAME \
--docker-server=DOCKER-IMAGE-REPOSITORY \
--docker-username=username@email.com \
--docker-password="password" \
--docker-email=username@email.com