《OpenShift 4.x HOL教程汇总》
说明:本文已经在OpenShift 4.10 / RHACS 3.71环境中验证
在 RHACS 中自带丰富的安全策略,可以帮助用户实现从镜像到容器、从网络到宿主机操作系统等各方面的安全检查。用户也可以定制个性化的策略来实现特性安全检查需求。
本示例将创建一个定制安全策略,该策略只针对 “生产集群” ,它不允许在生产环境中部署来自安全高风险的 docker.io 的容器镜像。




kind: Deployment
apiVersion: apps/v1
metadata:
name: hello-openshift
labels:
app: hello-openshift
app.kubernetes.io/name: hello-openshift
app.kubernetes.io/part-of: hello-openshift-app
spec:
replicas: 1
selector:
matchLabels:
app: hello-openshift
template:
metadata:
labels:
app: hello-openshift
spec:
containers:
- name: hello-openshift
image: docker.io/openshift/hello-openshift
ports:
- containerPort: 8080
protocol: TCP
- containerPort: 8888
protocol: TCP

kind: Deployment
apiVersion: apps/v1
metadata:
name: hello-openshift
labels:
app: hello-openshift
app.kubernetes.io/name: hello-openshift
app.kubernetes.io/part-of: hello-openshift-app
spec:
replicas: 1
selector:
matchLabels:
app: hello-openshift
template:
metadata:
labels:
app: hello-openshift
spec:
containers:
- name: hello-openshift
image: quay.io/dawnskyliu/hello-openshift
ports:
- containerPort: 8080
protocol: TCP
- containerPort: 8888
protocol: TCP
https://docs.openshift.com/acs/3.71/operating/manage-security-policies.html