data:
config: |
artifactRepository:
s3:
bucket: my-bucket
endpoint: argo-artifacts-minio.default:9000
insecure: true
# accessKeySecret and secretKeySecret are secret selectors.
# It references the k8s secret named 'argo-artifacts-minio'
# which was created during the minio helm install. The keys,
# 'accesskey' and 'secretkey', inside that secret are where the
# actual minio credentials are stored.
accessKeySecret:
name: argo-artifacts
key: accesskey
secretKeySecret:
name: argo-artifacts
key: secretkey
kubectl get secret
输出如下:
NAME TYPE DATA AGE
argo-artifacts Opaque 2 4h
default-token-2cvxb kubernetes.io/service-account-token 3 61d
#则argo-artifacts是我们需要的name
kubectl get secret/argo-artifacts -o wide
kubectl describe secret/argo-artifacts
输出
Name: argo-artifacts
Namespace: default
Labels: app=minio
chart=minio-1.9.1
heritage=Tiller
release=argo-artifacts
Annotations: <none>
Type: Opaque
Data
====
accesskey: 20 bytes
secretkey: 40 bytes
可以看到确实包含两个密钥文件。
但是要看到里面的密钥值比较麻烦,需要新建一个挂载这个secret的pod才能看到,步骤如下:
创建一个Pod通过卷访问秘密数据
下面是一个配置文件可以用来创建一个Pod:
vi secret-pod.yaml
输入内容如下:
apiVersion: v1
kind: Pod
metadata:
name: secret-test-pod
spec:
containers:
- name: test-container
image: nginx
volumeMounts:
# name must match the volume name below
- name: secret-volume
mountPath: /etc/secret-volume
# The secret data is exposed to Containers in the Pod through a Volume.
volumes:
- name: secret-volume
secret:
secretName: argo-artifacts