首页 > 其他分享 >k8s 创建普通用户访问dashboard

k8s 创建普通用户访问dashboard

时间:2023-08-07 14:37:04浏览次数:45  
标签:kubectl k8s user1 -- role dashboard io 普通用户 kube

签发用户证书

创建私钥

# (umask 077; openssl genrsa -out user1.key 2048)

创建CSR文件

下面的脚本展示了如何生成 PKI 私钥和 CSR。 设置 CSR 的 CN 和 O 属性很重要。CN 是用户名,O 是该用户归属的组。
# openssl req -new -key user1.key -out user1.csr -subj "/CN=user1/O=developers"

获取CSR文件base64编码

# cat user1.csr | base64 | tr -d "\n"
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0KTUlJQ2FqQ0NBVklDQVFBd0pURU9NQXdHQTFVRUF3d0ZkWE5sY2pFeEV6QVJCZ05WQkFvTUNtUmxkbVZzYjNCbApjbk13Z2dFaU1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQkR3QXdnZ0VLQW9JQkFRQzNGZkdGRm9hWnRxVFVnQUxiCmdZSjJBNU9ncmRHczJhK0FHWTl6NzNRcU1lczg2dUg5dForcTJiSk44TXZRYXlPUk9IVnJBQ3J2STBJQkxoK3IKbENESllRVms3YytkL0JaTWhDa3M2em5RU0ZMQndzdGJNRkIySVY5OXdXNzUwUlVMcnRYREUzTk8vRzdnWmpxaQpjWFdheERJYmw1Vjk4ZS92M2NGWk9aOXc5MnRSeDZJNUJQWUEwSlFiYTQ2QkllOTBFdmYzL1VMamJSS1lXTm1OCkZudnYwOXlqR21pU2M5OEpDRGtHTXptY0NRWjd5U1lRdzdFK3JVRVdjblM5clNQaURyMGJ0eWVhQU9YVjNxNkIKdHpmbW15T2NTWjVMKzVsV1NCTllyY2Q4TTVudXp1R204UjBqV3E1UWlDRlpmN3YzVzFDeVpGR0grYk5WUDkxYQpnTUx2QWdNQkFBR2dBREFOQmdrcWhraUc5dzBCQVFzRkFBT0NBUUVBYlMrbkJlaWVFK2o1bmF6YnNyWDZYVXpzCjMvZkpCOTN0MjVxcWE4bk94bWIyeUFMQjFkb090R1pndUt1Wi8zbE1DZk9Yd1RWTGN6WjVEbjJoY05Qa0ErbmsKUjF2bzNqZ0VuVGQ3ZTdaS1FhQkg2Z092Z2xPM01oWVhiK0xSUGFDUVJwRGs2NEdCL1dFYkpQK1RodzhSZVJheApmS3dlS3BDcXc5cDkySm9LQXRHYVgzVEdqR2ZJSHduNjhvcngxTzRQc0NkSnV6NElRNHpyLytJZkY0bE8welN6CjFCQjdGakhmemVmZ1B2M25pQjRDL2U0VDZTU21WbkEwaE4rYWZYd3FKbEtYV0pmeGJaaS9EQWN4SFQ1WXU3SC8KT0RwMlI5clR2bUJudHJVOFZJcHVlZkUvOFhCbWV4b01UelpwRFBmK1hQa0h3eXhSbDhwTFkzWVZ4NnU3NXc9PQotLS0tLUVORCBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0K

user1-csr.yaml

apiVersion: certificates.k8s.io/v1
kind: CertificateSigningRequest
metadata:
  name: user1
  namespace: demoapp
spec:
  request: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0KTUlJQ2FqQ0NBVklDQVFBd0pURU9NQXdHQTFVRUF3d0ZkWE5sY2pFeEV6QVJCZ05WQkFvTUNtUmxkbVZzYjNCbApjbk13Z2dFaU1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQkR3QXdnZ0VLQW9JQkFRQzNGZkdGRm9hWnRxVFVnQUxiCmdZSjJBNU9ncmRHczJhK0FHWTl6NzNRcU1lczg2dUg5dForcTJiSk44TXZRYXlPUk9IVnJBQ3J2STBJQkxoK3IKbENESllRVms3YytkL0JaTWhDa3M2em5RU0ZMQndzdGJNRkIySVY5OXdXNzUwUlVMcnRYREUzTk8vRzdnWmpxaQpjWFdheERJYmw1Vjk4ZS92M2NGWk9aOXc5MnRSeDZJNUJQWUEwSlFiYTQ2QkllOTBFdmYzL1VMamJSS1lXTm1OCkZudnYwOXlqR21pU2M5OEpDRGtHTXptY0NRWjd5U1lRdzdFK3JVRVdjblM5clNQaURyMGJ0eWVhQU9YVjNxNkIKdHpmbW15T2NTWjVMKzVsV1NCTllyY2Q4TTVudXp1R204UjBqV3E1UWlDRlpmN3YzVzFDeVpGR0grYk5WUDkxYQpnTUx2QWdNQkFBR2dBREFOQmdrcWhraUc5dzBCQVFzRkFBT0NBUUVBYlMrbkJlaWVFK2o1bmF6YnNyWDZYVXpzCjMvZkpCOTN0MjVxcWE4bk94bWIyeUFMQjFkb090R1pndUt1Wi8zbE1DZk9Yd1RWTGN6WjVEbjJoY05Qa0ErbmsKUjF2bzNqZ0VuVGQ3ZTdaS1FhQkg2Z092Z2xPM01oWVhiK0xSUGFDUVJwRGs2NEdCL1dFYkpQK1RodzhSZVJheApmS3dlS3BDcXc5cDkySm9LQXRHYVgzVEdqR2ZJSHduNjhvcngxTzRQc0NkSnV6NElRNHpyLytJZkY0bE8welN6CjFCQjdGakhmemVmZ1B2M25pQjRDL2U0VDZTU21WbkEwaE4rYWZYd3FKbEtYV0pmeGJaaS9EQWN4SFQ1WXU3SC8KT0RwMlI5clR2bUJudHJVOFZJcHVlZkUvOFhCbWV4b01UelpwRFBmK1hQa0h3eXhSbDhwTFkzWVZ4NnU3NXc9PQotLS0tLUVORCBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0K
  signerName: kubernetes.io/kube-apiserver-client
  expirationSeconds: 8640000  # 100天
  usages:
  - client auth

创建csr资源

# kubectl apply -f user1-csr.yaml
certificatesigningrequest.certificates.k8s.io/user1 created

查看CSR

# kubectl get csr -n demoapp
NAME    AGE   SIGNERNAME                            REQUESTOR   REQUESTEDDURATION   CONDITION
user1   63s   kubernetes.io/kube-apiserver-client   admin       100d                Pending

批准 CSR

# kubectl certificate approve user1 -n demoapp
certificatesigningrequest.certificates.k8s.io/user1 approved

查看CSR状态

# kubectl get csr -n demoapp
NAME    AGE    SIGNERNAME                            REQUESTOR   REQUESTEDDURATION   CONDITION
user1   2m9s   kubernetes.io/kube-apiserver-client   admin       100d                Approved,Issued

获取证书

# kubectl get csr user1 -o jsonpath='{.status.certificate}'| base64 -d > user1.crt

验证证书 

# openssl x509 -in user1.crt -text -noout
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            af:3b:4a:8c:e1:69:51:12:64:15:69:7a:a9:bd:b0:8d
        Signature Algorithm: sha256WithRSAEncryption
        Issuer: C = CN, ST = HangZhou, L = XS, O = k8s, OU = System, CN = kubernetes
        Validity
            Not Before: Aug  4 07:05:54 2023 GMT
            Not After : Nov 12 07:05:54 2023 GMT
        Subject: O = developers, CN = user1
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (2048 bit)
                Modulus:
                    00:b7:15:f1:85:16:86:99:b6:a4:d4:80:02:db:81:
                    82:76:03:93:a0:ad:d1:ac:d9:af:80:19:8f:73:ef:
                    74:2a:31:eb:3c:ea:e1:fd:b5:9f:aa:d9:b2:4d:f0:
                    cb:d0:6b:23:91:38:75:6b:00:2a:ef:23:42:01:2e:
                    1f:ab:94:20:c9:61:05:64:ed:cf:9d:fc:16:4c:84:
                    29:2c:eb:39:d0:48:52:c1:c2:cb:5b:30:50:76:21:
                    5f:7d:c1:6e:f9:d1:15:0b:ae:d5:c3:13:73:4e:fc:
                    6e:e0:66:3a:a2:71:75:9a:c4:32:1b:97:95:7d:f1:
                    ef:ef:dd:c1:59:39:9f:70:f7:6b:51:c7:a2:39:04:
                    f6:00:d0:94:1b:6b:8e:81:21:ef:74:12:f7:f7:fd:
                    42:e3:6d:12:98:58:d9:8d:16:7b:ef:d3:dc:a3:1a:
                    68:92:73:df:09:08:39:06:33:39:9c:09:06:7b:c9:
                    26:10:c3:b1:3e:ad:41:16:72:74:bd:ad:23:e2:0e:
                    bd:1b:b7:27:9a:00:e5:d5:de:ae:81:b7:37:e6:9b:
                    23:9c:49:9e:4b:fb:99:56:48:13:58:ad:c7:7c:33:
                    99:ee:ce:e1:a6:f1:1d:23:5a:ae:50:88:21:59:7f:
                    bb:f7:5b:50:b2:64:51:87:f9:b3:55:3f:dd:5a:80:
                    c2:ef
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Extended Key Usage: 
                TLS Web Client Authentication
            X509v3 Basic Constraints: critical
                CA:FALSE
            X509v3 Authority Key Identifier: 
                90:4F:95:52:FF:B2:B1:F7:04:60:1B:D8:21:EA:8F:F6:E6:39:CD:2B
    Signature Algorithm: sha256WithRSAEncryption
    Signature Value:
        36:53:c9:fa:ad:06:0a:65:fd:c8:17:6a:f9:f3:ca:c5:a5:7e:
        d9:e1:5c:8d:60:5d:e9:47:ce:f7:fd:68:2f:66:10:79:74:68:
        5f:e6:07:52:01:71:49:d8:5c:28:f7:e2:0c:1b:32:f3:f9:fa:
        d4:8a:e0:95:cd:f6:7d:4d:9b:a1:f3:da:fd:76:51:f5:15:25:
        2d:68:bd:3c:c2:fc:67:03:c6:db:b5:13:3b:6b:a2:56:7b:c8:
        85:eb:da:37:99:a3:10:5f:7e:10:7d:74:e7:6a:b9:c0:ca:fa:
        49:8a:d6:24:c9:1f:21:2d:f7:f9:c3:ca:9d:e5:0e:d7:08:bf:
        d8:83:08:b8:b9:fd:97:cc:47:13:e2:ab:27:94:2d:2b:a5:61:
        bf:7c:cd:de:eb:80:e0:a3:9e:90:4e:c1:67:ee:41:c7:a9:b6:
        64:19:97:b2:c5:c7:71:fb:aa:b6:75:ba:a6:22:16:76:9b:74:
        64:1b:e0:a4:cb:bd:9e:c8:f7:44:c1:e0:28:90:79:64:d1:21:
        8c:d6:51:4a:9f:ad:49:d6:5b:4c:e5:ad:71:cf:6b:83:1e:ad:
        d4:93:35:d2:2e:67:e4:c8:d2:38:81:9f:01:2a:bb:c3:62:01:
        c4:1f:8c:78:bc:63:e5:4f:4d:f9:2d:2e:33:b2:7c:d5:89:00:
        cc:6d:63:85

创建用户

demoapp-ns.yaml

apiVersion: v1
kind: Namespace
metadata:
  name: demoapp

serviceaccount-user1.yaml

apiVersion: v1
kind: ServiceAccount
metadata:
  name: user1
  namespace: demoapp

创建user1资源

# kubectl apply -f demoapp-ns.yaml -f serviceaccount-user1.yaml
namespace/demoapp created
serviceaccount/user1 created

查看user1资源

# kubectl get serviceaccount -n demoapp
NAME      SECRETS   AGE
default   0         54s
user1     0         54s

创建role

user1-role.yaml

---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  namespace: demoapp
  name: user1-role
rules:
- apiGroups: ["*"] # "" 表示核心群组
  resources: ["pods", "services", "pods/log"]
  verbs: ["get", "watch", "list"]

创建role资源

# kubectl apply -f user1-role.yaml
role.rbac.authorization.k8s.io/user1-role created

查看role资源

# kubectl get role -n demoapp
NAME         CREATED AT
user1-role   2023-08-04T07:34:14Z

查看role规则

# kubectl describe role user1-role -n demoapp
Name:         user1-role
Labels:       <none>
Annotations:  <none>
PolicyRule:
  Resources   Non-Resource URLs  Resource Names  Verbs
  ---------   -----------------  --------------  -----
  pods.*/log  []                 []              [get watch list]
  pods.*      []                 []              [get watch list]
  services.*  []                 []              [get watch list]

角色绑定

role-bind-user1.yaml

apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: role-bing-user1
  namespace: demoapp
subjects:
- kind: ServiceAccount
  name: user1 
  namespace: demoapp
roleRef:
  kind: Role        
  name: user1-role  
  apiGroup: rbac.authorization.k8s.io

创建rolebinging资源

# kubectl apply -f role-bind-user1.yaml
rolebinding.rbac.authorization.k8s.io/role-bing-user1 created

查看RoleBinding资源

# kubectl get rolebinding -n demoapp
NAME              ROLE              AGE
role-bing-user1   Role/user1-role   82s

查看RoleBinding规则

# kubectl describe rolebinding/role-bing-user1 -n demoapp
Name:         role-bing-user1
Labels:       <none>
Annotations:  <none>
Role:
  Kind:  Role
  Name:  user1-role
Subjects:
  Kind            Name   Namespace
  ----            ----   ---------
  ServiceAccount  user1

为user1手动创建长期 API 令牌

user1-secret.yaml

apiVersion: v1
kind: Secret
metadata:
  name: user1-secret
  namespace: demoapp
  annotations:
    kubernetes.io/service-account.name: user1
type: kubernetes.io/service-account-token

创建secret资源

# kubectl apply -f user1-secret.yaml
secret/user1-secret created

查看token

# kubectl get secret user1-secret -n demoapp -o jsonpath={".data.token"} | base64 -d
eyJhbGciOiJSUzI1NiIsImtpZCI6IklkYWRmQU53aV8yYlU4amdheGY0aXhseVNDMDhOZFg3SElVdjNFbHowaFEifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJkZW1vYXBwIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6InVzZXIxLXNlY3JldCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJ1c2VyMSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6IjY2ZDgwMjQxLTM0MzEtNDIzNS1hNjE4LTRhYjM4MWNkZjE2NCIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDpkZW1vYXBwOnVzZXIxIn0.e_afkGL9vVAcsHnMF4SzN00iqHCMy6iHJkwRmthz9q6YC0zCGs6ltmvhmy5GqS7yTSIYy_RROVT12PTaq2WqIgoZV-ZT14oDQbc9gs9l9ssssyRtXyj9lglb4SADBxYv5cxBIFW-BodpsnG8J8j-QqbmCUViXe5EJky5pi4xVmS7ezzRmdcYUfjE0Xzq6c3gib4nU9KutvgqOG8zve35cRQ4Ca6jedFj23Yb9n7q_x8Ozpt9JfU9XopinjqS8M4uSHYy7BmTY9UgZnEA6xUOmG-TIAJZyEeBLaGHiBS7Lo2aA0uU_zj224efU7QoliyL8nBBLYynvLEtRRnV1g5QTg

创建kubeconfig

添加集群信息

# kubectl config set-cluster developer --embed-certs=true --certificate-authority=/etc/kubernetes/ssl/ca.pem --server="https://127.0.0.1:6443" --kubeconfig=$HOME/.kube/kube-user1.config
Cluster "developer" set.

添加用户信息

# kubectl config set-credentials user1 --embed-certs=true --client-certificate=user1.crt --client-key=user1.key --token=eyJhbGciOiJSUzI1NiIsImtpZCI6IklkYWRmQU53aV8yYlU4amdheGY0aXhseVNDMDhOZFg3SElVdjNFbHowaFEifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJkZW1vYXBwIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6InVzZXIxLXNlY3JldCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJ1c2VyMSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6IjY2ZDgwMjQxLTM0MzEtNDIzNS1hNjE4LTRhYjM4MWNkZjE2NCIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDpkZW1vYXBwOnVzZXIxIn0.e_afkGL9vVAcsHnMF4SzN00iqHCMy6iHJkwRmthz9q6YC0zCGs6ltmvhmy5GqS7yTSIYy_RROVT12PTaq2WqIgoZV-ZT14oDQbc9gs9l9ssssyRtXyj9lglb4SADBxYv5cxBIFW-BodpsnG8J8j-QqbmCUViXe5EJky5pi4xVmS7ezzRmdcYUfjE0Xzq6c3gib4nU9KutvgqOG8zve35cRQ4Ca6jedFj23Yb9n7q_x8Ozpt9JfU9XopinjqS8M4uSHYy7BmTY9UgZnEA6xUOmG-TIAJZyEeBLaGHiBS7Lo2aA0uU_zj224efU7QoliyL8nBBLYynvLEtRRnV1g5QTg --kubeconfig=$HOME/.kube/kube-user1.config
User "user1" set.

添加上下文信息

# kubectl config set-context user1 --cluster=developer --namespace=demoapp --user=user1 --kubeconfig=$HOME/.kube/kube-user1.config
Context "user1" created.

查看当前上下文

# kubectl config get-contexts --kubeconfig=$HOME/.kube/kube-user1.config
CURRENT   NAME    CLUSTER     AUTHINFO   NAMESPACE
          user1   developer   user1      demoapp

切换当前上下文

# kubectl config use-context user1  --kubeconfig=$HOME/.kube/kube-user1.config
Switched to context "user1".

查看kubeconfig文件

# kubectl config view --kubeconfig=$HOME/.kube/kube-user1.config
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://127.0.0.1:6443
  name: developer
contexts:
- context:
    cluster: developer
    namespace: demoapp
    user: user1
  name: user1
current-context: user1
kind: Config
preferences: {}
users:
- name: user1
  user:
    client-certificate-data: REDACTED
    client-key-data: REDACTED
    token: REDACTED

登录dashboard

 

k8s 创建普通用户访问dashboard_d3

 

k8s 创建普通用户访问dashboard_2d_02

验证权限

验证deployments权限

k8s 创建普通用户访问dashboard_2d_03

添加deployment权限

user1-role.yaml

apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  namespace: demoapp
  name: user1-role
rules:
- apiGroups: ["*"] # "" 表示核心群组
  resources: ["pods", "services", "pods/log","deployments"]   # deployments
  verbs: ["get", "watch", "list"]

更新权限

# kubectl apply -f user1-role.yaml
role.rbac.authorization.k8s.io/user1-role configured

再次验证deployments权限

k8s 创建普通用户访问dashboard_3d_04



标签:kubectl,k8s,user1,--,role,dashboard,io,普通用户,kube
From: https://blog.51cto.com/wangguishe/6993373

相关文章

  • 使用kubeadm快速部署一个k8s集群
    1.部署Kubernetes集群方式(1)kubeadmKubeadm是一个K8s部署工具,提供kubeadminit和kubeadmjoin,用于快速部署Kubernetes集群。官方地址:https://kubernetes.io/zh-cn/docs/reference/setup-tools/kubeadm/(2)二进制包从github下载发行版的二进制包,手动部署每个组件,组成Kube......
  • k8s 部分节点 nodelocaldns [ERROR] Failed to read node-cache coreFile /etc/coredn
      部分K8S节点nodelocaldnsCrashLoopBackOff状态报错,报错信息如下:#kubectllogsnodelocaldns-w9mgz-nkube-system2023/08/0703:18:33[INFO]UsingCorefile/etc/coredns/Corefile2023/08/0703:18:33[ERROR]Failedtoreadnode-cachecoreFile/etc/coredns/Co......
  • Spring Boot + k8s = 王炸!
    来源:https://blog.csdn.net/qq_14999375/article/details/123309636前言K8s+SpringBoot实现零宕机发布:健康检查+滚动更新+优雅停机+弹性伸缩+Prometheus监控+配置分离(镜像复用)配置健康检查健康检查类型:就绪探针(readiness)+存活探针(liveness)探针类型:exec(进入容器执行脚本......
  • k8s 学习笔记之数据存储——基础存储
    在前面已经提到,容器的生命周期可能很短,会被频繁地创建和销毁。那么容器在销毁时,保存在容器中的数据也会被清除。这种结果对用户来说,在某些情况下是不乐意看到的。为了持久化保存容器的数据,kubernetes引入了Volume的概念。Volume是Pod中能够被多个容器访问的共享目录,它被定......
  • IDEA微服务开启RunDashboard|services
    IDEA微服务开启RunDashboard|services在微服务工程中,我们有时需要启动多个模块,RunDashboard【运行仪表盘】可以更好的帮助我们进行对启动的多个服务进行管理1、当前工程打开.idea文件夹下workspace.xml2、增加以下代码<componentname="RunDashboard"><optionname="con......
  • k8s实战案例之运行Java单体服务-jenkins
    1、jenkins架构基于java命令,运⾏javawar包或jar包,本次以jenkins.war包部署⽅式为例,且要求jenkins的数据保存⾄外部存储(NFS或者PVC),其他java应⽤看实际需求是否需要将数据保存⾄外部存储。从上述架构图可以看到,Jenkins通过k8s上的pv/pvc来连接外部存储,通过svc的方式向外暴露......
  • k8s 学习笔记之 Service——Service 的使用
    实验环境准备在使用service之前,首先利用Deployment创建出3个pod,注意要为pod设置app=nginx-pod的标签创建deployment.yaml,内容如下:apiVersion:apps/v1kind:Deploymentmetadata:name:pc-deploymentnamespace:devspec:replicas:3selector:......
  • k8s 学习笔记之 Service——Service 介绍和类型
    Service介绍在kubernetes中,pod是应用程序的载体,我们可以通过pod的ip来访问应用程序,但是pod的ip地址不是固定的,这也就意味着不方便直接采用pod的ip对服务进行访问。为了解决这个问题,kubernetes提供了Service资源,Service会对提供同一个服务的多个pod进行聚......
  • k8s 学习笔记之 Pod 控制器——StatefulSet
    StatefulSetStatefulSet是用来管理有状态应用的工作负载API对象。StatefulSet用来管理某Pod集合的部署和扩缩,并为这些Pod提供持久存储和持久标识符。和Deployment类似,StatefulSet管理基于相同容器规约的一组Pod。但和Deployment不同的是,StatefulSet为它们的每个......
  • k8s 学习笔记之 Pod 控制器——DaemonSet(DS)
    DaemonSet(DS)DaemonSet类型的控制器可以保证在集群中的每一台(或指定)节点上都运行一个副本。一般适用于日志收集、节点监控等场景。也就是说,如果一个Pod提供的功能是节点级别的(每个节点都需要且只需要一个),那么这类Pod就适合使用DaemonSet类型的控制器创建。DaemonSet控......