@@ -126,12 +126,13 @@ state for some duration:
126
126
<!--
127
127
## Signers
128
128
129
- All signers should provide information about how they work
129
+ Custom signerNames can also be specified. All signers should provide information about how they work
130
130
so that clients can predict what will happen to their CSRs.
131
131
This includes:
132
132
-->
133
133
## 签名者 {#signers}
134
134
135
+ 也可以指定自定义 signerName。
135
136
所有签名者都应该提供自己工作方式的信息,
136
137
以便客户端可以预期到他们的 CSR 将发生什么。
137
138
此类信息包括:
@@ -423,8 +424,8 @@ O is the group that this user will belong to. You can refer to
423
424
你可以参考 [ RBAC] ( /zh/docs/reference/access-authn-authz/rbac/ ) 了解标准组的信息。
424
425
425
426
``` shell
426
- openssl genrsa -out john .key 2048
427
- openssl req -new -key john .key -out john .csr
427
+ openssl genrsa -out myuser .key 2048
428
+ openssl req -new -key myuser .key -out myuser .csr
428
429
```
429
430
430
431
<!--
@@ -443,7 +444,7 @@ cat <<EOF | kubectl apply -f -
443
444
apiVersion: certificates.k8s.io/v1
444
445
kind: CertificateSigningRequest
445
446
metadata:
446
- name: john
447
+ name: myuser
447
448
spec:
448
449
groups:
449
450
- system:authenticated
@@ -459,13 +460,13 @@ Some points to note:
459
460
460
461
- `usages` has to be '`client auth`'
461
462
- `request` is the base64 encoded value of the CSR file content.
462
- You can use this command to get that ```cat john .csr | base64 | tr -d "\n"```
463
+ You can get the content using this command: ```cat myuser .csr | base64 | tr -d "\n"```
463
464
-->
464
465
需要注意的几点:
465
466
466
467
- ` usage ` 字段必须是 '` client auth ` '
467
468
- ` request ` 字段是 CSR 文件内容的 base64 编码值。
468
- 要得到该值,可以执行命令 ` cat john .csr | base64 | tr -d "\n" ` 。
469
+ 要得到该值,可以执行命令 ` cat myuser .csr | base64 | tr -d "\n" ` 。
469
470
470
471
<!--
471
472
### Approve certificate signing request
@@ -490,7 +491,7 @@ Approve the CSR:
490
491
批准 CSR:
491
492
492
493
``` shell
493
- kubectl certificate approve john
494
+ kubectl certificate approve myuser
494
495
```
495
496
496
497
<!--
@@ -503,14 +504,23 @@ Retrieve the certificate from the CSR.
503
504
从 CSR 取得证书:
504
505
505
506
``` shell
506
- kubectl get csr/john -o yaml
507
+ kubectl get csr/myuser -o yaml
507
508
```
508
509
509
510
<!--
510
511
The Certificate value is in Base64-encoded format under `status.certificate`.
512
+
513
+ Export the issued certificate from the CertificateSigningRequest.
514
+
511
515
-->
512
516
证书的内容使用 base64 编码,存放在字段 ` status.certificate ` 。
513
517
518
+ 从 CertificateSigningRequest 导出颁发的证书。
519
+
520
+ ```
521
+ kubectl get csr myuser -o jsonpath='{.status.certificate}'| base64 -d > myuser.crt
522
+ ```
523
+
514
524
<!--
515
525
### Create Role and Role Binding
516
526
@@ -536,14 +546,13 @@ This is a sample command to create a RoleBinding for this new user:
536
546
下面是为这个新用户创建 RoleBinding 的示例命令:
537
547
538
548
``` shell
539
- kubectl create rolebinding developer-binding-john --role=developer --user=john
549
+ kubectl create rolebinding developer-binding-myuser --role=developer --user=myuser
540
550
```
541
551
542
552
<!--
543
553
### Add to kubeconfig
544
554
545
555
The last step is to add this user into the kubeconfig file.
546
- We assume the key and crt files are located here "/home/vagrant/work/".
547
556
548
557
First, we need to add new credentials:
549
558
-->
@@ -555,7 +564,7 @@ First, we need to add new credentials:
555
564
首先,我们需要添加新的凭据:
556
565
557
566
``` shell
558
- kubectl config set-credentials john --client-key=/home/vagrant/work/john .key --client-certificate=/home/vagrant/work/john .crt --embed-certs=true
567
+ kubectl config set-credentials myuser --client-key=myuser .key --client-certificate=myuser .crt --embed-certs=true
559
568
560
569
```
561
570
@@ -565,16 +574,16 @@ Then, you need to add the context:
565
574
然后,你需要添加上下文:
566
575
567
576
``` shell
568
- kubectl config set-context john --cluster=kubernetes --user=john
577
+ kubectl config set-context myuser --cluster=kubernetes --user=myuser
569
578
```
570
579
571
580
<!--
572
- To test it, change context to `john`
581
+ To test it, change the context to `myuser`:
573
582
-->
574
- 来测试一下,把上下文切换为 ` john ` :
583
+ 来测试一下,把上下文切换为 ` myuser ` :
575
584
576
585
``` shell
577
- kubectl config use-context john
586
+ kubectl config use-context myuser
578
587
```
579
588
580
589
<!--
@@ -684,12 +693,12 @@ status:
684
693
<!--
685
694
It's usual to set `status.conditions.reason` to a machine-friendly reason
686
695
code using TitleCase; this is a convention but you can set it to anything
687
- you like. If you want to add a note just for human consumption, use the
696
+ you like. If you want to add a note for human consumption, use the
688
697
` status.conditions.message` field.
689
698
-->
690
699
` status.conditions.reason` 字段通常设置为一个首字母大写的对机器友好的原因码;
691
700
这是一个命名约定,但你也可以随你的个人喜好设置。
692
- 如果你想添加一个仅供人类使用的注释 ,那就用 `status.conditions.message` 字段。
701
+ 如果你想添加一个供人类使用的注释 ,那就用 `status.conditions.message` 字段。
693
702
694
703
<!--
695
704
# # Signing
0 commit comments