@@ -109,7 +109,7 @@ into the cluster.
109
109
现在先将它们下载到名为 ` profiles/ ` 的目录中,以便将它们加载到集群中。
110
110
111
111
{{< tabs name="tab_with_code" >}}
112
- {{{ < tab name="audit.json" >}}
112
+ {{< tab name="audit.json" >}}
113
113
{{< codenew file="pods/security/seccomp/profiles/audit.json" >}}
114
114
{{< /tab >}}
115
115
{{< tab name="violation.json" >}}
@@ -120,7 +120,9 @@ into the cluster.
120
120
{{< /tab >}}}
121
121
{{< /tabs >}}
122
122
123
- <!-- Run these commands: -->
123
+ <!--
124
+ Run these commands:
125
+ -->
124
126
执行这些命令:
125
127
126
128
``` shell
@@ -131,7 +133,9 @@ curl -L -o profiles/fine-grained.json https://k8s.io/examples/pods/security/secc
131
133
ls profiles
132
134
```
133
135
134
- <!-- You should see three profiles listed at the end of the final step: -->
136
+ <!--
137
+ You should see three profiles listed at the end of the final step:
138
+ -->
135
139
你应该看到在最后一步的末尾列出有三个配置文件:
136
140
```
137
141
audit.json fine-grained.json violation.json
@@ -186,7 +190,7 @@ before you continue.
186
190
{{< glossary_tooltip text="容器运行时" term_id="container-runtime" >}}
187
191
默认首选的配置文件,而不是回退到 ` Unconfined ` 。
188
192
如果你想尝试,请在继续之前参阅
189
- [ 启用使用 ` RuntimeDefault ` 作为所有工作负载的默认 seccomp 配置文件] ( #enable-runtimedefault-as-default )
193
+ [ 启用使用 ` RuntimeDefault ` 作为所有工作负载的默认 seccomp 配置文件] ( #enable-runtimedefault-as-default ) 。
190
194
191
195
<!--
192
196
Once you have a kind configuration in place, create the kind cluster with
@@ -214,6 +218,7 @@ You should see output indicating that a container is running with name
214
218
-->
215
219
你应该看到输出中名为 ` kind-control-plane ` 的容器正在运行。
216
220
输出类似于:
221
+
217
222
```
218
223
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
219
224
6a96207fed4b kindest/node:v1.18.2 "/usr/local/bin/entr…" 27 seconds ago Up 24 seconds 127.0.0.1:42223->6443/tcp kind-control-plane
@@ -366,7 +371,9 @@ nodes:
366
371
seccomp-default: "true"
367
372
` ` `
368
373
369
- <!-- If the cluster is ready, then running a pod: -->
374
+ <!--
375
+ If the cluster is ready, then running a pod:
376
+ -->
370
377
如果集群已就绪,则运行一个 Pod:
371
378
372
379
` ` ` shell
@@ -428,7 +435,9 @@ the native API fields in favor of the annotations.
428
435
请在可能的情况下使用原生 API 字段而不是注解。
429
436
{{< /note >}}
430
437
431
- <!-- Create the Pod in the cluster: -->
438
+ <!--
439
+ Create the Pod in the cluster:
440
+ -->
432
441
在集群中创建 Pod:
433
442
434
443
``` shell
@@ -463,15 +472,20 @@ that allows access to the endpoint from inside the kind control plane container.
463
472
kubectl expose pod audit-pod --type NodePort --port 5678
464
473
```
465
474
466
- <!-- Check what port the Service has been assigned on the node. -->
475
+ <!--
476
+ Check what port the Service has been assigned on the node.
477
+ -->
467
478
检查 Service 在节点上分配的端口。
468
479
469
480
``` shell
470
481
kubectl get service audit-pod
471
482
```
472
483
473
- <!-- The output is similar to: -->
484
+ <!--
485
+ The output is similar to:
486
+ -->
474
487
输出类似于:
488
+
475
489
```
476
490
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
477
491
audit-pod NodePort 10.111.36.142 <none> 5678:32373/TCP 72s
@@ -548,22 +562,24 @@ kubectl delete pod audit-pod --wait --now
548
562
```
549
563
550
564
<!--
551
- ## Create Pod with seccomp profile that causes violation
565
+ ## Create Pod with a seccomp profile that causes violation
552
566
553
567
For demonstration, apply a profile to the Pod that does not allow for any
554
568
syscalls.
555
569
556
570
The manifest for this demonstration is:
557
571
-->
558
- ## 使用导致违规的 seccomp 配置文件创建 Pod {#create-pod-with-seccomp-profile-that-causes-violation}
572
+ ## 使用导致违规的 seccomp 配置文件创建 Pod {#create-pod-with-a- seccomp-profile-that-causes-violation}
559
573
560
574
出于演示目的,将配置文件应用于不允许任何系统调用的 Pod 上。
561
575
562
576
此演示的清单是:
563
577
564
578
{{< codenew file="pods/security/seccomp/ga/violation-pod.yaml" >}}
565
579
566
- <!-- Attempt to create the Pod in the cluster: -->
580
+ <!--
581
+ Attempt to create the Pod in the cluster:
582
+ -->
567
583
尝试在集群中创建 Pod:
568
584
569
585
``` shell
@@ -606,8 +622,8 @@ Clean up that Pod before moving to the next section:
606
622
kubectl delete pod violation-pod --wait --now
607
623
```
608
624
609
- <!--
610
- ## Create Pod with seccomp profile that only allows necessary syscalls
625
+ <!--
626
+ ## Create Pod with a seccomp profile that only allows necessary syscalls
611
627
612
628
If you take a look at the `fine-grained.json` profile, you will notice some of the syscalls
613
629
seen in syslog of the first example where the profile set `"defaultAction":
@@ -618,7 +634,7 @@ sent to `syslog`.
618
634
619
635
The manifest for this example is:
620
636
-->
621
- ## 使用只允许必要的系统调用的 seccomp 配置文件创建 Pod {#create-pod-with-seccomp-profile-that-only-allows-necessary-syscalls}
637
+ ## 使用只允许必要的系统调用的 seccomp 配置文件创建 Pod {#create-pod-with-a- seccomp-profile-that-only-allows-necessary-syscalls}
622
638
623
639
如果你看一看 ` fine-grained.json ` 配置文件,
624
640
你会注意到第一个示例的 syslog 中看到的一些系统调用,
@@ -631,7 +647,9 @@ The manifest for this example is:
631
647
632
648
{{< codenew file="pods/security/seccomp/ga/fine-pod.yaml" >}}
633
649
634
- <!-- Create the Pod in your cluster: -->
650
+ <!--
651
+ Create the Pod in your cluster:
652
+ -->
635
653
在你的集群中创建 Pod:
636
654
637
655
``` shell
@@ -642,8 +660,11 @@ kubectl apply -f https://k8s.io/examples/pods/security/seccomp/ga/fine-pod.yaml
642
660
kubectl get pod fine-pod
643
661
```
644
662
645
- <!-- The Pod should be showing as having started successfully: -->
663
+ <!--
664
+ The Pod should be showing as having started successfully:
665
+ -->
646
666
此 Pod 应该显示为已成功启动:
667
+
647
668
```
648
669
NAME READY STATUS RESTARTS AGE
649
670
fine-pod 1/1 Running 0 30s
@@ -660,28 +681,36 @@ mention calls from `http-echo`:
660
681
tail -f /var/log/syslog | grep ' http-echo'
661
682
```
662
683
663
- <!-- Next, expose the Pod with a NodePort Service: -->
684
+ <!--
685
+ Next, expose the Pod with a NodePort Service:
686
+ -->
664
687
接着,使用 NodePort Service 公开 Pod:
665
688
666
689
``` shell
667
690
kubectl expose pod fine-pod --type NodePort --port 5678
668
691
```
669
692
670
- <!-- Check what port the Service has been assigned on the node: -->
693
+ <!--
694
+ Check what port the Service has been assigned on the node:
695
+ -->
671
696
检查节点上的 Service 分配了什么端口:
672
697
673
698
``` shell
674
699
kubectl get service fine-pod
675
700
```
676
701
677
- <!-- The output is similar to: -->
702
+ <!--
703
+ The output is similar to:
704
+ -->
678
705
输出类似于:
679
706
```
680
707
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
681
708
fine-pod NodePort 10.111.36.142 <none> 5678:32373/TCP 72s
682
709
```
683
710
684
- <!-- Use `curl` to access that endpoint from inside the kind control plane container: -->
711
+ <!--
712
+ Use `curl` to access that endpoint from inside the kind control plane container:
713
+ -->
685
714
使用 ` curl ` 从 kind 控制平面容器内部访问端点:
686
715
687
716
``` shell
@@ -745,8 +774,11 @@ for all its containers:
745
774
746
775
{{< codenew file="pods/security/seccomp/ga/default-pod.yaml" >}}
747
776
748
- <!-- Create that Pod: -->
777
+ <!--
778
+ Create that Pod:
779
+ -->
749
780
创建此 Pod:
781
+
750
782
``` shell
751
783
kubectl apply -f https://k8s.io/examples/pods/security/seccomp/ga/default-pod.yaml
752
784
```
@@ -755,14 +787,19 @@ kubectl apply -f https://k8s.io/examples/pods/security/seccomp/ga/default-pod.ya
755
787
kubectl get pod default-pod
756
788
```
757
789
758
- <!-- The Pod should be showing as having started successfully: -->
790
+ <!--
791
+ The Pod should be showing as having started successfully:
792
+ -->
759
793
此 Pod 应该显示为成功启动:
794
+
760
795
```
761
796
NAME READY STATUS RESTARTS AGE
762
797
default-pod 1/1 Running 0 20s
763
798
```
764
799
765
- <!-- Finally, now that you saw that work OK, clean up: -->
800
+ <!--
801
+ Finally, now that you saw that work OK, clean up:
802
+ -->
766
803
最后,你看到一切正常之后,请清理:
767
804
768
805
``` shell
0 commit comments