当前位置: 首页 > news >正文

2024 CKA模拟系统制作 | Step-By-Step | 8、题目搭建-创建 Ingress

目录

 ​​​​​​免费获取题库配套 CKA_v1.31_模拟系统 

一、题目

二、核心考点

Ingress 资源定义

Ingress Controller 依赖

服务暴露验证

网络层次关系

三、搭建模拟环境

1.创建命名空间

2.安装ingress ingress-nginx-controller

3.创建hello.yaml并部署

 四、总结


 ​​​免费获取题库配套 CKA_v1.31_模拟系统 

一、题目

您必须在以下Cluster/Node上完成此考题:    

  Cluster                                   Master node                                  Worker node

    hk8s                                         master                                            node01

设置配置环境:

[candidate@node01]$  kubectl config use-context hk8s

.

Context

将外部流量按照ingress规则引入内部服务

.

Task

如下创建一个新的 nginx Ingress 资源:
.
name : ping
namespace : ing-internal
.
使用服务端口 5678  在路径 /hello 上公开服务 hello 。 可以使用以下命令检查服务 hello  的可用性,该命令应返回 hello :
.
curl -kL INTERNAL_IP/hello

二、核心考点

  1. Ingress 资源定义

    • 名称与命名空间规范:name: pingnamespace: ing-internal

    • 路径与服务端口映射:/hello → service hello:5678

  2. Ingress Controller 依赖

    • 必须部署 Nginx Ingress Controller

    • 控制器与 Ingress 资源的关联机制

  3. 服务暴露验证

    • 获取 Ingress 访问端点(INTERNAL_IP)

    • 使用 curl -kL 测试路径响应

  4. 网络层次关系

三、搭建模拟环境

1.创建命名空间

kubectl create ns ing-internal

2.安装ingress ingress-nginx-controller

#下载ingress-nginx-controller.yaml文件 
wget https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.9.6/deploy/static/provider/cloud/deploy.yaml
mv deploy.yaml ingress-nginx-controller.yaml#将yaml文件中的namespace设置变更成题目要求的namespace
apiVersion: v1
kind: Namespace
metadata:labels:app.kubernetes.io/instance: ingress-nginxapp.kubernetes.io/name: ingress-nginxname: ing-internal#然后所有
namespace: ing-internal#将此行注释掉
externalTrafficPolicy: Local#将service ingress-nginx-controller的type: LoadBalancer将慈航改成ClusterIP才能按照题目要求配置完ingress策略后出现IP
type: ClusterIP ---
#题目中无IngressClass,故将类模块注释掉
#apiVersion: networking.k8s.io/v1
#kind: IngressClass
#metadata:
#  labels:
#    app.kubernetes.io/component: controller
#    app.kubernetes.io/instance: ingress-nginx
#    app.kubernetes.io/name: ingress-nginx
#    app.kubernetes.io/part-of: ingress-nginx
#    app.kubernetes.io/version: 1.9.6
#  name: nginx
#spec:
#  controller: k8s.io/ingress-nginx
---#应用yaml文件,开始安装
kubectl apply -f ingress-nginx-controller.yaml

3.创建hello.yaml并部署

hello.yaml文件

apiVersion: apps/v1
kind: Deployment
metadata:name: hellonamespace: ing-internallabels:name: hello
spec:replicas: 1selector:matchLabels:name: hellotemplate:metadata:labels:name: hellospec:containers:- name: helloimage: hello-world:2.0ports:- containerPort: 80name: http-web-svc
---
apiVersion: v1
kind: Service
metadata:name: hellonamespace: ing-internal
spec:selector:name: helloports:- name: hello-of-service-portprotocol: TCPport: 5678targetPort: http-web-svc

部署yaml文件

kubectl apply -f hello.yaml

 四、总结

1.题库主要考察的是Ingress策略,所以必须部署Ingress controller

2.考试环境中是没有ingressclass的,需要自己创建一个默认类就可以,但是Ingress controller是默认带了的,为了题目效果要注释掉。

3.service ingress-nginx-controller的type: LoadBalancer将慈航改成ClusterIP才能按照题目要求配置完ingress策略后出现IP


CKA高仿真环境简单演示视频 

相关文章:

  • STM32F407寄存器操作(多通道单ADC+DMA)
  • PINN for PDE(偏微分方程)1 - 正向问题
  • Beta分布Dirichlet分布
  • Baklib知识中台加速企业服务智能化实践
  • 算法学习--持续更新
  • 头歌之动手学人工智能-Pytorch 之优化
  • 接口自动化常用断言方式
  • 目标检测我来惹1 R-CNN
  • C#实现远程锁屏
  • 【C++】cin和cout的性能问题讨论和优化方法
  • Linux 驱动之设备树
  • c++第四章练习题
  • openpnp - 给M4x0.7mm的直油嘴加油的工具选择
  • day025-网络基础-DNS与ARP协议
  • 征程 6 J6EM 常见 qconfig 配置解读与示例
  • LangGraph(八)——LangGraph运行时
  • 博士论文写作笔记
  • 【大模型DA】Unified Language-driven Zero-shot Domain Adaptation
  • agent-zero: 打造你的AI专属AI助理
  • Canvas: trying to draw too large(256032000bytes) bitmap.
  • 政务服务 网站 建设方案/他达拉非片和伟哥区别
  • 做游戏交易网站/谷歌ads广告投放
  • dedecms网站空白/深圳信息公司做关键词
  • 如何自己做网站及优化/黄冈网站建设收费
  • 做网站设计多少钱/网站运维
  • 大东吴建设新材料公司网站/互联网营销推广公司