CKS killer.sh模拟环境设置
发表于|更新于|kubernetesCKS
|总字数:98|阅读时长:1分钟|浏览量:
预先设置环境变量, 提高效率
alias k=kubectl # kubectl 命令可以使用k代替 |
vim 设置
echo "ts=2 sw=2 et ai" >> ~/.vimrc |
设置空格, tab,为2, tab为2空格, 换行自动对齐
文章作者: Hao
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Hao DevSecOps!
相关推荐

2023-01-30
CKS 题库 10、Trivy 扫描镜像安全漏洞
Task使用 Trivy 开源容器扫描器检测 namespace kamino 中 具有严重漏洞的镜像 的 Pod。 查找具有 High 或 Critical 严重性漏洞的镜像,并删除使用这些镜像的 Pod 。 注意:Trivy 仅安装在 cluster 的 master 节点上, 在工作节点上不可使用。 你必须切换到 cluster 的 master 节点才能使用 Trivy 参考资料https://kubernetes.io/zh-cn/docs/reference/kubectl/cheatsheet/#格式化输出 解答 切换集群 kubectl config use-context KSSC00401 查看namespace下pod 和image kubectl get pods -n kamino -o=custom-columns="NAME:.metadata.name,IMAGE:.spec.containers[*].image" 提取镜像名并进行扫描 kubectl describe pod -n kamino | g...

2023-01-31
CKS 模拟真题 Killer.sh | Question 2 | Runtime Security with Falco
Task weight: 4% Use context: kubectl config use-context workload-prod Falco is installed with default configuration on node cluster1-node1 . Connect using ssh cluster1-node1 . Use it to: Find a Pod running image nginx which creates unwanted package management processes inside its container. Find a Pod running image httpd which modifies /etc/passwd . Save the Falco logs for case 1 under /opt/course/2/falco.log in format: time-with-nanosconds,container-id,container-name,user-name No other i...

2023-01-31
CKS 模拟真题 Killer.sh | Question 4 | Pod Security Standard
Task weight: 8% Use context: kubectl config use-context workload-prod There is Deployment container-host-hacker in Namespace team-red which mounts /run/containerd as a hostPath volume on the Node where it’s running. This means that the Pod can access various data about other containers running on the same Node. To prevent this configure Namespace team-red to enforce the baseline Pod Security Standard. Once completed, delete the Pod of the Deployment mentioned above. Check the Replic...

2023-01-30
CKS 题库 14、启用API server认证
Context由 kubeadm 创建的 cluster 的 Kubernetes API 服务器,出于测试目的, 临时配置允许未经身份验证和未经授权的访问,授予匿名用户 cluster-admin 的访问权限. Task重新配置 cluster 的 Kubernetes APl 服务器,以确保只允许经过身份验证和授权的 REST 请求。 使用授权模式 Node , RBAC 和准入控制器 NodeRestriction 。 删除用户 system:anonymous 的 ClusterRoleBinding 来进行清理。 注意:所有 kubectl 配置环境/文件也被配置使用未经身份验证和未经授权的访问。 你不必更改它,但请注意,一旦完成 cluster 的安全加固, kubectl 的配置将无法工作。 您可以使用位于 cluster 的 master 节点上,cluster 原本的 kubectl 配置文件 /etc/kubernetes/admin.conf ,以确保经过身份验证的授权的请求仍然被允许。 模拟环境里,初始化这道题的脚本为b.sh 参考h...

2023-02-02
CKS 模拟真题 Killer.sh | Preview Question 2
Use context: kubectl config use-context infra-prod There is an existing Open Policy Agent + Gatekeeper policy to enforce that all Namespaces need to have label security-level set. Extend the policy constraint and template so that all Namespaces also need to set label management-team . Any new Namespace creation without these two labels should be prevented. Write the names of all existing Namespaces which violate the updated policy into /opt/course/p2/fix-namespaces . 译文使用上下文: kubectl confi...

2023-01-29
CKS 题库 2、Pod指定ServiceAccount
Context您组织的安全策略包括: ServiceAccount不得自动挂载API凭据 ServiceAccount名称必须以“-sa”结尾 清单文件 /cks/sa/pod1.yaml 中指定的Pod由于 ServiceAccount 指定错误而无法调度。 请完成以下项目: Task 在现有namespace qa 中创建一个名为 backend-sa 的新ServiceAccount, 确保此ServiceAccount不自动挂载API凭据。 使用 /cks/sa/pod1.yaml 中的清单文件来创建一个Pod。 最后,清理 namespace qa 中任何 未使用的 ServiceAccount。 参考https://kubernetes.io/zh-cn/docs/tasks/configure-pod-container/configure-service-account/#使用默认的服务账户访问-api-服务器 解答切换集群 kubectl config use-context KSCH00301 创建 ServiceAccountvi qa-s...
评论
公告
站点进行了迁移, 如需帮助, 请发邮件到 admin@hao.kim


