secret

Secret 的功能类似于configmap给pod提供额外的配置信息,但是secret是一种包含少量敏感信息例如密码,令牌或秘钥的对象

Secret的名称必须是合法的DNS子域名

每个Secret的大小最多为1Mib,主要是为了避免用户创建非常大的Secret进而导致API服务器和kubelet内存耗尽,不过创建很多小的Secret也可能耗尽内存,可以使用资源配额来约束每个名字空间中的Secret个数

在通过yaml文件创建secret时,可以设置data或stringData字段,data和stringData字段都是可选的,data字段中所有的键值都必须是base64编码的字符串,如果不希望执行这种base64字符串的转换操作,也可以选择设置stringData字段,其中可以使用任何非加密的字符串作为其值。

Pod可以用三种方式的任意一种来使用Secret

  • 作为挂载到一个或多个容器上的卷中的文件(crt文件,key文件)
  • 作为容器的环境变量
  • 由kubelet在为pod拉取镜像时使用(与镜像仓库的认证)
一、Secret类型:

kubernetes默认支持多种不同类型的secret,用于不同的使用场景,不同类型的secret的配置参数也不一样

Secret类型 使用场景
Opaque 用户定义的任意数据
kubernetes.io/service-account-token ServiceAccount 令牌
kubernetes.io/dockercfg ~/.dockercfg文件的序列化形式
kuberentes.io/dockerconfigjson ~/.docker/config.json文件的序列化形式 (harbor token)
kubernetes.io/ssh-auth 用于SSH身份认证的凭据
kubernetes.io/basic-auth 用于基本身份认证的凭据
kubernetes.io/tls 用于TLS环境,保存crt证书和key证书(nginx)
bootstrap.kubernetes.io/token 启动引导令牌数据

1、Opaque类型:

[root@haproxy1 case11-secret]# cat 1-secret-Opaque-data.yaml 
apiVersion: v1
kind: Secret
metadata:
  name: mysecret-data
  namespace: myserver
type: Opaque
data:
  user: YWRtaW4K
  password: MTIzNDU2Cg==
#使用该secret
[root@haproxy1 case11-secret]# cat 3-secret-Opaque-mount.yaml 
#apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
  name: myserver-myapp-app1-deployment
  namespace: myserver
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myserver-myapp-app1
  template:
    metadata:
      labels:
        app: myserver-myapp-app1
    spec:
      containers:
      - name: myserver-myapp-app1
        image: tomcat:7.0.94-alpine
        ports:
        - containerPort: 8080
        volumeMounts:
        - mountPath: /data/myserver/auth
          name: myserver-auth-secret 
      volumes:
      - name: myserver-auth-secret
        secret:
          secretName: mysecret-data

---
apiVersion: v1
kind: Service
metadata:
  name: myserver-myapp-app1
  namespace: myserver
spec:
  ports:
  - name: http
    port: 8080
    targetPort: 8080
    nodePort: 30018
    protocol: TCP
  type: NodePort
  selector:
    app: myserver-myapp-app1

其实secret文件在宿主机上

[root@haproxy1 case11-secret]# kubectl get pods -n myserver -o wide 
NAME                                READY   STATUS    RESTARTS   AGE    IP               NODE            NOMINATED NODE   READINESS GATES
nginx-deployment-74884bcb49-qlb4t   1/1     Running   0          3d2h   10.200.169.187   172.16.92.141   <none>           <none>
[root@haproxy1 case11-secret]# 
#切换到141节点
[root@k8s-node2 ~]# find / -name 'password'
/var/lib/docker/overlay2/decf6b3c70bec605802f5824d982e12694f9aa75ecf085da17b7061cc36cfaa8/diff/var/lib/pam/password
/var/lib/docker/overlay2/1131ff1fd5fdc33c09af75345f10acc00cffff2e6b9f37402df3130606c7c00f/diff/etc/openldap/certs/password
/var/lib/docker/overlay2/18ac3e1b60586687ead24191c62597ca4a158506cbccceba53a770114c9cb0d0/diff/var/lib/pam/password
/var/lib/docker/overlay2/1cca6cd2f57a6d21aab637d8452ac1570a8434f8106d5b6f43823fafd0a0c263/diff/var/lib/pam/password
/var/lib/docker/overlay2/7358f47add11f41973fdf6c201d0f1961738ee879b56062b4e256854a6a60df1/diff/var/lib/pam/password
/var/lib/docker/overlay2/93756e042d8e6f52623036eca0a1ea732c7c31f05cdbe2771e70199efaba686e/merged/var/lib/pam/password
/var/lib/docker/overlay2/4ba8f3e91be4ef9317c60e320ee738b8b454df6fed0ed4008c4db16cdd3d17f0/merged/etc/openldap/certs/password
/var/lib/docker/overlay2/7580b8986873ffe858a426a12a1b36dd81ea97d1a6eb1bfd39bf28a0d615d7b3/merged/var/lib/pam/password
/var/lib/docker/overlay2/829c438193e680be085f965ab2eaa410e8990d6fc8d14e08c131ade7d152264b/merged/var/lib/pam/password
/var/lib/kubelet/pods/3e85f165-ec0e-4c9c-8d23-718f8a86fe39/volumes/kubernetes.io~secret/nginx-config/password
/var/lib/kubelet/pods/3e85f165-ec0e-4c9c-8d23-718f8a86fe39/volumes/kubernetes.io~secret/nginx-config/..2022_05_21_05_38_53.1146412810/password
/etc/openldap/certs/password
[root@k8s-node2 ~]# cat /var/lib/kubelet/pods/3e85f165-ec0e-4c9c-8d23-718f8a86fe39/volumes/kubernetes.io~secret/nginx-config/password
123456[root@k8s-node2 ~]# cat /var/lib/kubelet/pods/3e85f165-ec0e-4c9c-8d23-718f8a86fe39/volumes/kubernetes.io~secret/nginx-config/..2022_05_21_05_38_53.1146412810/password
123456[root@k8s-node2 ~]# 

也可以通过etcd查询

[root@etcd2 ~]# etcdctl get / --keys-only --prefix |grep mysecret 
/registry/secrets/myserver/mysecret-stringdata
[root@etcd2 ~]# etcdctl  get /registry/secrets/myserver/mysecret-stringdata
/registry/secrets/myserver/mysecret-stringdata
k8s


v1Secret
         mysecret-stringdatmyserver"*$7c1bcec5-dd72-4ce3-9113-c86cad036a452

2、创建tls类型

[root@haproxy1 case11-secret]# 
[root@haproxy1 case11-secret]# kubectl create secret --help
Create a secret using specified subcommand.

Available Commands:
  docker-registry 创建一个给 Docker registry 使用的 secret
  generic         Create a secret from a local file, directory, or literal value
  tls             创建一个 TLS secret

Usage:
  kubectl create secret [flags] [options]

Use "kubectl <command> --help" for more information about a given command.
Use "kubectl options" for a list of global command-line options (applies to all commands).

自签名证书

[root@haproxy1 certs-test]# openssl  req -x509 -sha256 -newkey rsa:4096 -keyout ca.key -out ca.crt -days 3560 -nodes -subj '/CN=www.ca.com'
Generating a 4096 bit RSA private key
.....................................................................................................................................................................++
........................................++
writing new private key to 'ca.key'
-----
[root@haproxy1 certs-test]# 
[root@haproxy1 certs-test]# openssl req -new -newkey rsa:4096 -keyout server.key -out server.csr -nodes -subj '/CN=www.mysite.com'
Generating a 4096 bit RSA private key
..................................................................................................++
....................................................................................++
writing new private key to 'server.key'
-----
[root@haproxy1 certs-test]# openssl x509 -req -sha256 -days 3650 -in server.csr -CA ca.crt  -CAkey ca.key  -set_serial 01 -out server.crt
Signature ok
subject=/CN=www.mysite.com
Getting CA Private Key
[root@haproxy1 certs-test]# ll
总用量 20
-rw-r--r-- 1 root root 1789 521 20:09 ca.crt
-rw-r--r-- 1 root root 3272 521 20:09 ca.key
-rw-r--r-- 1 root root 1667 521 20:11 server.crt
-rw-r--r-- 1 root root 1590 521 20:10 server.csr
-rw-r--r-- 1 root root 3268 521 20:10 server.key

创建secret

[root@haproxy1 certs-test]# kubectl create secret tls  myserver-tls --cert=./server.crt  --key=./server.key  -n myserver 
secret/myserver-tls created
[root@haproxy1 certs-test]# kubectl get secrets  -n myserver 
NAME                  TYPE                                  DATA   AGE
default-token-2htdj   kubernetes.io/service-account-token   3      6d1h
myserver-tls          kubernetes.io/tls                     2      96s
[root@haproxy1 certs-test]# 
[root@haproxy1 certs-test]# kubectl describe secrets -n myserver myserver-tls 
Name:         myserver-tls
Namespace:    myserver
Labels:       <none>
Annotations:  <none>

Type:  kubernetes.io/tls

Data
====
tls.crt:  1667 bytes
tls.key:  3268 bytes

[root@haproxy1 certs-test]# kubectl get secrets -n myserver  myserver-tls  -o yaml 
apiVersion: v1
data:
  tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVvakNDQW9vQ0FRRXdEUVlKS29aSWh2Y05BUUVMQlFBd0ZURVRNQkVHQTFVRUF3d0tkM2QzTG1OaExtTnYKYlRBZUZ3MHlNakExTWpFeE1qRXhORGhhRncwek1qQTFNVGd4TWpFeE5EaGFNQmt4RnpBVkJnTlZCQU1NRG5kMwpkeTV0ZVhOcGRHVXVZMjl0TUlJQ0lqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FnOEFNSUlDQ2dLQ0FnRUEzby8xCmhJTjQzU0MycWVyU1dCeT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uid: dbfe8d83-bc9c-495b-8eb3-93bd61ff3584
type: kubernetes.io/tls


#上面的公钥和私钥其实都是通过base64加密的,可以进行解密查看
[root@haproxy1 certs-test]# echo "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVvakNDQW9vQ0FRRXdEUVlKS29aSWh2Y05BUUVMQlFBd0ZURVRNQkVHQTFVRUF3d0tkM2QzTG1OaExtTnYKYlRBZUZ3MHlNakExTWpFeE1qRXhORGhhRncwek1qQTFNVGd4TWpFeE5EaGFNQmt4RnpBVkJnTlZCQU1NRG5kMwpkeTV0ZVhOcGRHVXVZMjl0TUlJQ0lqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FnOEFNSUlDQ2dLQ0FnRUEzby8xCmhJTjQzU0MycWVyU1dCeTRxZUNvOU5nMGJTWE1JMXNkajdBTzVlaEVhL0tQUnpPd0JzWTg3WXBpQUQ3NU5kZ3AKMnA4S1FtWDZmNUpvTDdBNXFWMzdoSzQzK0F4QVBWb1g0MGhCdk43V0h2TUZOSGJZN3FYRnFiRk5vRzNLZVB4ZApqalcvaC94b3I3d3B5eHJmMVlpSm9zaktyV3lLQ3JpR1lBemUxY2VURXU4YjdUN2Z5T0MxT0U4QWFqekFpM0RwCjZwTnUzL1BWNmpkMDN3azlJUnp1RW9BZTg4dTZmMVI2cEZGdEZ3K1JTa1R6R2RVWkRLOTlXMWNxTXpYUVlVdS8KY2Yxb1dTMmppdmtGK0dkdTlsRUM0NTdhakd1RStxQVNaNVNVOWIwcldJRGZxeGtYaCtqc21Udmg3WnZ2NkpxcAo3RXUxTVgvdUovUE9FUVMrcUpvOURDNnFEREFyM0R0TW5OczFXTjFibmp2UDhaUyt0TTN1MXd4UkhtLzU5MExCCkp1MWtYWU43cGxWcEdNZzh1WDd0ZXFZQVA4bEJoTVBIWVhnaHZZemwyNkJXMjZpcGJNM3Jhejc5elhlVk5ta0oKU1h6eU9aNmwxZEJGazJ5WHJDVllhQ1JpY1RGNDJsUl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