logo
Alauda Container Platform
English
简体中文
English
简体中文
logo
Alauda Container Platform
导航

产品概览

架构
发版日志

安装

安装概述

安装准备

前提条件
下载
节点预处理
安装
global 集群灾难恢复

升级

Overview
升级前准备
升级 global 集群
升级业务集群

用户界面

灵雀控制台

概览
访问 Web 控制台
Customizing the Web Console
Customizing the Left Navigation
CLI 工具

配置

功能开关配置

集群

概述
创建本地集群
etcd 加密
自动旋转 Kubernetes 证书

实用指南

为内置注册表添加外部地址
选择容器运行时
更新公共仓库凭证

网络

介绍

架构

理解 Kube-OVN
了解 ALB
了解 MetalLB

核心概念

认证
Ingress-nginx 注解兼容性
TCP/HTTP 保持连接
ModSecurity
不同 Ingress 方式的比较
HTTP 重定向
L4/L7 超时
GatewayAPI
OTel

功能指南

创建服务
创建 Ingress
配置网关
创建 Ingress-Nginx
创建域名
创建证书
创建外部 IP 地址池
创建 BGP Peers
配置子网
配置网络策略
创建 Admin 网络策略
配置集群网络策略

如何操作

为 ALB 部署高可用 VIP
软件数据中心负载均衡方案(Alpha)
准备 Kube-OVN Underlay 物理网络
Underlay 和 Overlay 子网的自动互联
在 ALB 中使用 OAuth Proxy
创建 GatewayAPI Gateway
配置负载均衡器
如何合理分配 CPU 和内存资源
将 IPv6 流量转发到集群内的 IPv4 地址
Calico 网络支持 WireGuard 加密
Kube-OVN Overlay 网络支持 IPsec 加密
ALB 监控
Application Load Balancer (ALB) 中的负载均衡会话亲和策略

故障排除

如何解决 ARM 环境中的节点间通信问题?
查找错误原因

机器配置

概览
使用 MachineConfig 管理节点配置
节点中断策略

存储

介绍

概念

访问模式与卷模式
核心概念
Persistent Volume

功能指南

创建 CephFS 文件存储类型存储类
创建 CephRBD 块存储类
创建 TopoLVM 本地存储类
创建 NFS 共享存储类
部署 Volume Snapshot 组件
创建 PV
创建 PVCs
使用卷快照

实用指南

设置 NFS 共享存储类的子目录命名规则
通用临时卷
使用 emptyDir
第三方存储能力注解指南

故障排除

从 PVC 扩容失败中恢复

存储

Ceph 分布式存储

介绍

安装

创建标准类型集群
创建 Stretch 类型集群
架构

核心概念

核心概念

操作指南

访问存储服务
管理存储池
节点特定组件部署
添加设备/设备类
监控与告警

实用指南

配置专用集群用于分布式存储
清理分布式存储

数据容灾

文件存储灾备
块存储灾难恢复
对象存储灾备
更新优化参数
创建 ceph 对象存储用户

MinIO 对象存储

介绍
安装
架构

核心概念

核心概念

操作指南

添加存储池
Monitoring & Alerts

实用指南

数据灾难恢复

TopoLVM 本地存储

介绍
安装

操作指南

设备管理
监控与告警

实用指南

使用 Velero 备份和恢复 TopoLVM 文件系统 PVC

安全

Alauda Container Security

安全性与合规性

合规

介绍
安装

使用指南

私有镜像仓库访问配置
Image Signature Verification Policy
使用 Secrets 的镜像签名验证策略
镜像仓库验证策略
容器逃逸防护策略
Security Context Enforcement Policy
网络安全策略
Volume Security Policy

API Refiner

介绍
安装

用户与角色

用户

介绍

功能指南

管理用户角色
创建用户
用户管理

用户组

介绍

功能指南

管理用户组角色
创建本地用户组
管理本地用户组成员资格

角色

介绍

功能指南

创建角色
管理自定义角色

IDP

介绍

功能指南

LDAP 管理
OIDC 管理

故障排除

删除用户

用户策略

介绍

多租户(项目)

介绍

功能指南

创建项目
管理项目
管理项目集群
管理项目成员

审计

介绍

遥测

安装

虚拟化

虚拟化

概览

介绍
安装

镜像

介绍

操作指南

添加虚拟机镜像
更新/删除虚拟机镜像
更新/删除镜像凭据

实用指南

使用 KubeVirt 基于 ISO 创建 Windows 镜像
使用 KubeVirt 基于 ISO 创建 Linux 镜像
导出虚拟机镜像
权限说明

虚拟机

介绍

操作指南

创建虚拟机/虚拟机组
虚拟机批量操作
使用 VNC 登录虚拟机
管理密钥对
管理虚拟机
监控与告警
虚拟机快速定位

实用指南

配置 USB 主机直通
虚拟机热迁移
虚拟机恢复
在 KubeVirt 上克隆虚拟机
物理 GPU 直通环境准备
配置虚拟机的高可用性
从现有虚拟机创建虚拟机模板

问题处理

虚拟机节点正常关机下的 Pod 迁移及异常宕机恢复问题
热迁移错误信息及解决方案

网络

介绍

操作指南

配置网络

实用指南

通过网络策略实现虚拟机网络请求控制
配置 SR-IOV
配置虚拟机使用网络绑定模式以支持 IPv6

存储

介绍

操作指南

管理虚拟磁盘

备份和恢复

介绍

操作指南

使用快照

开发者

快速开始

Creating a simple application via image

构建应用

核心概念

应用类型
Custom Applications
Workload Types
理解参数
理解环境变量
理解启动命令
资源单位说明

命名空间

创建命名空间
导入 Namespace
Resource Quota
Limit Range
Pod Security Admission
Overcommit Ratio
管理命名空间成员
更新命名空间
删除/移除命名空间

创建应用

Creating applications from Image
Creating applications from Chart
通过 YAML 创建应用
通过代码创建应用
Creating applications from Operator Backed
通过 CLI 工具创建应用

应用的操作与维护

Application Rollout

安装 Alauda Container Platform Argo Rollouts
Application Blue Green Deployment
Application Canary Deployment
状态说明

KEDA(Kubernetes Event-driven Autoscaling)

KEDA Overview
Installing KEDA

实用指南

Integrating ACP Monitoring with Prometheus Plugin
在 KEDA 中暂停自动扩缩容
配置 HPA
启动和停止原生应用
配置 VerticalPodAutoscaler (VPA)
配置 CronHPA
更新原生应用
导出应用
更新和删除 Chart 应用
应用版本管理
删除原生应用
健康检查

计算组件

Deployments
DaemonSets
StatefulSets
CronJobs
任务
Pods
Containers
使用 Helm charts

配置

Configuring ConfigMap
Configuring Secrets

应用可观测

监控面板
Logs
实时事件

实用指南

设置定时任务触发规则

镜像仓库

介绍

安装

通过 YAML 安装
通过 Web UI 安装

使用指南

Common CLI Command Operations
Using Alauda Container Platform Registry in Kubernetes Clusters

S2I

介绍

安装

Installing Alauda Container Platform Builds

升级

升级 Alauda Container Platform Builds
架构

功能指南

Managing applications created from Code

How To

通过代码创建应用

节点隔离策略

引言
架构

概念

核心概念

功能指南

创建节点隔离策略
权限说明
常见问题

GitOps

介绍

安装

Installing Alauda Build of Argo CD
Installing Alauda Container Platform GitOps

升级

Upgrading Alauda Container Platform GitOps
架构

核心概念

GitOps

Argo CD 核心概念

Argo CD Introduction
Application 概念
ApplicationSet 概念
Tool
Helm 概念
Kustomize 概念
Directory 概念
Sync 概念
Health 概念

Alauda Container Platform GitOps 核心概念

介绍
Alauda Container Platform GitOps 的同步及健康检查

功能指南

创建 GitOps 应用

Creating GitOps Application
Creating GitOps ApplicationSet

GitOps 可观测

Argo CD 组件监控
GitOps 应用运维

实用指南

通过 Argo CD Dashboard 集成代码仓库
通过 Argo CD dashboard 创建 Argo CD Application
通过平台创建 Argo CD Application
如何获取 Argo CD 访问信息
故障排查

扩展

Operator
集群插件

可观测性

概览

监控

介绍
安装

架构

监控模块架构
监控组件选型指南
核心概念

操作指南

指标管理
告警管理
通知管理
监控面板管理
探针管理

实用指南

Prometheus 监控数据的备份与恢复
VictoriaMetrics 监控数据备份与恢复
从自定义命名的网络接口采集网络数据

调用链

介绍
安装
架构
核心概念

操作指南

查询追踪
查询追踪日志

实用指南

Java 应用无侵入方式接入调用链
与 TraceID 相关的业务日志

问题处理

查询不到所需的调用链
调用链数据不完整

日志

介绍
安装

架构

日志模块架构
日志组件选型指南
日志组件容量规划
概念

操作指南

日志

实用指南

如何将日志归档至第三方存储
如何对接外部 ES 存储集群

事件

介绍
Events

巡检

介绍
架构

操作指南

巡检
Component Health Status

硬件加速器

概述

介绍
功能概览
安装

应用开发

介绍

功能指南

CUDA 驱动与运行时兼容性
使用 ConfigMap 添加自定义设备

故障排除

解决 vLLM 中 “float16 is only supported on GPUs with compute capability at least xx” 错误
Paddle Autogrow 内存分配在 GPU-Manager 上的崩溃问题

配置管理

介绍

功能指南

在 GPU 节点上配置硬件加速器

资源监控

介绍

功能指南

GPU 资源监控

Alauda 服务网格

关于 Alauda Service Mesh

Alauda AI

关于 Alauda AI

Alauda DevOps

关于灵雀云 DevOps

Alauda 计量计费

关于 Alauda 成本管理

Alauda 应用服务

概览

介绍
架构
安装
升级

Alauda Database Service for MySQL

关于 Alauda Database Service for MySQL-MGR
关于 Alauda Database Service for MySQL-PXC

Alauda Cache Service for Redis OSS

关于 Alauda Cache Service for Redis OSS

Alauda Streaming Service for Kafka

About Alauda Streaming Service for Kafka

Alauda Streaming Service for RabbitMQ

关于 Alauda Streaming Service for RabbitMQ

Alauda support for PostgreSQL

关于 Alauda support for PostgreSQL

运维管理

介绍

参数模板管理

介绍

功能指南

参数模板管理

备份管理

介绍

功能指南

外部 S3 存储
备份管理

检查管理

介绍

操作指南

创建巡检任务
Exec Inspection Task
更新和删除巡检任务

实用指南

如何设置检查调度?

检查优化建议

MySQL

MySQL IO负载优化
MySQL 内存使用优化
MySQL存储空间优化
MySQL 活动线程计数优化
MySQL 行锁优化

Redis

Redis 大键
Redis中的高CPU使用率
Redis中的高内存使用

Kafka

Kafka 中的高 CPU 利用率
Kafka Rebalance 优化
Kafka内存使用优化
Kafka 存储空间优化

RabbitMQ

RabbitMQ Mnesia 数据库异常处理

警报管理

介绍

操作指南

与平台能力的关系

升级管理

介绍

操作指南

示例升级

API 参考

概览

介绍
Kubernetes API 使用指南

Advanced APIs

Alert APIs

AlertHistories [v1]
AlertHistoryMessages [v1]
AlertStatus [v2]
SilenceStatus [v2]

Event APIs

Search

Log APIs

Aggregation
Archive
Context
Search

Monitoring APIs

Indicators [monitoring.alauda.io/v1beta1]
Metrics [monitoring.alauda.io/v1beta1]
Variables [monitoring.alauda.io/v1beta1]

Kubernetes APIs

Alert APIs

AlertTemplate [alerttemplates.aiops.alauda.io/v1beta1]
PrometheusRule [prometheusrules.monitoring.coreos.com/v1]

Inspection APIs

Inspection [inspections.ait.alauda.io/v1alpha1]

Notification APIs

Notification [notifications.ait.alauda.io/v1beta1]
NotificationGroup [notificationgroups.ait.alauda.io/v1beta1]
NotificationTemplate [notificationtemplates.ait.alauda.io/v1beta1]
📝 在 GitHub 上编辑此页
上一页Security Context Enforcement Policy
下一页Volume Security Policy

#网络安全策略

本指南演示如何配置 Kyverno 以强制执行网络安全策略,控制容器的网络访问并防止基于网络的攻击。

#目录

#什么是网络安全?

网络安全涉及控制容器如何访问和交互网络资源。适当的网络安全可以防止:

  • 主机网络访问:容器访问主机网络接口
  • 通过网络的权限提升:利用网络访问获得提升权限
  • 端口扫描和侦察:未经授权的网络发现活动
  • 横向移动:容器访问非预期的网络资源
  • 数据外泄:未经授权的网络通信

#快速开始

#1. 禁止主机网络访问

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: disallow-host-network
  annotations:
    policies.kyverno.io/title: Disallow Host Network
    policies.kyverno.io/category: Pod Security Standards (Baseline)
    policies.kyverno.io/severity: medium
    policies.kyverno.io/subject: Pod
    policies.kyverno.io/description: >-
      Access to the host network allows potential snooping of network traffic and should not be allowed.
spec:
  validationFailureAction: Enforce
  background: true
  rules:
    - name: host-network
      match:
        any:
        - resources:
            kinds:
            - Pod
      validate:
        message: >-
          Use of host network is disallowed. The field spec.hostNetwork must be unset or set to false.
        pattern:
          spec:
            =(hostNetwork): "false"

#2. 测试策略

# 应用策略
kubectl apply -f disallow-host-network.yaml

# 尝试创建使用主机网络的 pod(应失败)
kubectl run test-hostnet --image=nginx --overrides='{"spec":{"hostNetwork":true}}'

# 尝试创建普通 pod(应成功)
kubectl run test-normal --image=nginx

#核心网络安全策略

#策略 1:禁止主机端口

防止容器绑定主机网络端口:

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: disallow-host-ports
  annotations:
    policies.kyverno.io/title: Disallow Host Ports
    policies.kyverno.io/category: Pod Security Standards (Baseline)
    policies.kyverno.io/severity: medium
    policies.kyverno.io/subject: Pod
    policies.kyverno.io/description: >-
      Access to host ports allows potential snooping of network traffic and should not be
      allowed, or at minimum restricted to a known list.
spec:
  validationFailureAction: Enforce
  background: true
  rules:
    - name: host-ports-none
      match:
        any:
        - resources:
            kinds:
            - Pod
      validate:
        message: >-
          Use of host ports is disallowed. The fields spec.containers[*].ports[*].hostPort,
          spec.initContainers[*].ports[*].hostPort, and spec.ephemeralContainers[*].ports[*].hostPort
          must either be unset or set to 0.
        pattern:
          spec:
            =(ephemeralContainers):
              - =(ports):
                  - =(hostPort): 0
            =(initContainers):
              - =(ports):
                  - =(hostPort): 0
            containers:
              - =(ports):
                  - =(hostPort): 0

#策略 2:限制主机端口范围

允许特定的主机端口范围以实现受控访问:

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: restrict-host-port-range
  annotations:
    policies.kyverno.io/title: Restrict Host Port Range
    policies.kyverno.io/category: Pod Security Standards (Baseline)
    policies.kyverno.io/severity: medium
    policies.kyverno.io/subject: Pod
    policies.kyverno.io/description: >-
      Host ports, if used, must be within an allowed range to prevent conflicts and security issues.
spec:
  validationFailureAction: Enforce
  background: true
  rules:
    - name: host-port-range
      match:
        any:
        - resources:
            kinds:
            - Pod
      preconditions:
        all:
        - key: "{{ request.object.spec.containers[].ports[?hostPort] | length(@) }}"
          operator: GreaterThan
          value: 0
      validate:
        message: >-
          Host ports must be within the allowed range 30000-32767.
        foreach:
        - list: request.object.spec.[ephemeralContainers, initContainers, containers][].ports[]
          preconditions:
            any:
            - key: "{{ element.hostPort }}"
              operator: GreaterThan
              value: 0
          deny:
            conditions:
              any:
              - key: "{{ element.hostPort }}"
                operator: LessThan
                value: 30000
              - key: "{{ element.hostPort }}"
                operator: GreaterThan
                value: 32767

#策略 3:要求网络策略

确保 Pod 关联有 NetworkPolicies 以控制流量:

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: require-network-policies
  annotations:
    policies.kyverno.io/title: Require Network Policies
    policies.kyverno.io/category: Network Security
    policies.kyverno.io/severity: medium
    policies.kyverno.io/subject: Pod,NetworkPolicy
    policies.kyverno.io/description: >-
      Pods should have associated NetworkPolicies to control network traffic.
spec:
  validationFailureAction: Enforce
  background: false
  rules:
    - name: require-netpol
      match:
        any:
        - resources:
            kinds:
            - Pod
      exclude:
        any:
        - resources:
            namespaces:
            - kube-system
            - kyverno
      context:
      - name: netpols
        apiCall:
          urlPath: "/apis/networking.k8s.io/v1/namespaces/{{ request.namespace }}/networkpolicies"
          jmesPath: "items[?spec.podSelector.matchLabels.app == '{{ request.object.metadata.labels.app }}'] | length(@)"
      validate:
        message: >-
          Pods must have an associated NetworkPolicy. Create a NetworkPolicy that selects this pod.
        deny:
          conditions:
            all:
            - key: "{{ netpols }}"
              operator: Equals
              value: 0

#策略 4:限制 Service 类型

控制允许创建的 Service 类型:

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: restrict-service-types
  annotations:
    policies.kyverno.io/title: Restrict Service Types
    policies.kyverno.io/category: Network Security
    policies.kyverno.io/severity: medium
    policies.kyverno.io/subject: Service
    policies.kyverno.io/description: >-
      Restrict Service types to prevent exposure of services to external networks.
spec:
  validationFailureAction: Enforce
  background: true
  rules:
    - name: restrict-nodeport
      match:
        any:
        - resources:
            kinds:
            - Service
      validate:
        message: >-
          NodePort services are not allowed. Use ClusterIP or LoadBalancer instead.
        pattern:
          spec:
            type: "!NodePort"
    - name: restrict-loadbalancer
      match:
        any:
        - resources:
            kinds:
            - Service
            namespaces:
            - development
            - dev-*
            - staging
      validate:
        message: >-
          LoadBalancer services are not allowed in development environments.
        pattern:
          spec:
            type: "!LoadBalancer"

#策略 5:控制 Ingress 配置

强制安全的 Ingress 配置:

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: secure-ingress-configuration
  annotations:
    policies.kyverno.io/title: Secure Ingress Configuration
    policies.kyverno.io/category: Network Security
    policies.kyverno.io/severity: medium
    policies.kyverno.io/subject: Ingress
    policies.kyverno.io/description: >-
      Ingress resources must be configured securely with TLS and proper annotations.
spec:
  validationFailureAction: Enforce
  background: true
  rules:
    - name: require-tls
      match:
        any:
        - resources:
            kinds:
            - Ingress
      validate:
        message: >-
          Ingress must use TLS. The field spec.tls must be specified.
        pattern:
          spec:
            tls:
            - hosts:
              - "*"
    - name: require-security-annotations
      match:
        any:
        - resources:
            kinds:
            - Ingress
      validate:
        message: >-
          Ingress must have security annotations for SSL redirect and HSTS.
        pattern:
          metadata:
            annotations:
              nginx.ingress.kubernetes.io/ssl-redirect: "true"
              nginx.ingress.kubernetes.io/force-ssl-redirect: "true"

#策略 6:限制 DNS 配置

控制 DNS 设置以防止基于 DNS 的攻击:

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: restrict-dns-configuration
  annotations:
    policies.kyverno.io/title: Restrict DNS Configuration
    policies.kyverno.io/category: Network Security
    policies.kyverno.io/severity: medium
    policies.kyverno.io/subject: Pod
    policies.kyverno.io/description: >-
      Restrict DNS configuration to prevent DNS hijacking and data exfiltration.
spec:
  validationFailureAction: Enforce
  background: true
  rules:
    - name: restrict-dns-policy
      match:
        any:
        - resources:
            kinds:
            - Pod
      validate:
        message: >-
          Custom DNS policy is not allowed. Use Default or ClusterFirst only.
        pattern:
          spec:
            =(dnsPolicy): "Default | ClusterFirst"
    - name: restrict-custom-dns
      match:
        any:
        - resources:
            kinds:
            - Pod
      validate:
        message: >-
          Custom DNS configuration is not allowed in production environments.
        pattern:
          spec:
            X(dnsConfig): "null"

#高级场景

#场景 1:环境特定的网络策略

针对不同环境的不同网络限制:

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: environment-network-security
spec:
  validationFailureAction: Enforce
  background: true
  rules:
    # 生产环境:严格的网络控制
    - name: production-network-restrictions
      match:
        any:
        - resources:
            kinds:
            - Pod
            namespaces:
            - production
            - prod-*
      validate:
        message: "Production environments require strict network security"
        pattern:
          spec:
            hostNetwork: "false"
            dnsPolicy: "ClusterFirst"
            containers:
            - ports:
              - =(hostPort): 0
    
    # 开发环境:基础网络安全
    - name: development-network-restrictions
      match:
        any:
        - resources:
            kinds:
            - Pod
            namespaces:
            - development
            - dev-*
            - staging
      validate:
        message: "Development environments require basic network security"
        pattern:
          spec:
            hostNetwork: "false"

#场景 2:应用特定的网络策略

针对不同应用类型的不同网络策略:

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: application-network-policies
spec:
  validationFailureAction: Enforce
  background: true
  rules:
    # 数据库应用:禁止外部网络访问
    - name: database-network-policy
      match:
        any:
        - resources:
            kinds:
            - Pod
            selector:
              matchLabels:
                app.type: database
      validate:
        message: "Database applications cannot use host network or host ports"
        pattern:
          spec:
            hostNetwork: "false"
            containers:
            - ports:
              - =(hostPort): 0
    
    # Web 应用:受控端口访问
    - name: web-app-network-policy
      match:
        any:
        - resources:
            kinds:
            - Pod
            selector:
              matchLabels:
                app.type: web
      validate:
        message: "Web applications can only use standard HTTP/HTTPS ports"
        foreach:
        - list: request.object.spec.containers[].ports[]
          deny:
            conditions:
              any:
              - key: "{{ element.containerPort }}"
                operator: AnyNotIn
                value:
                - 80
                - 443
                - 8080
                - 8443

#场景 3:网络分段强制执行

强制不同层级之间的网络分段:

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: network-segmentation-enforcement
spec:
  validationFailureAction: Enforce
  background: true
  rules:
    - name: frontend-backend-separation
      match:
        any:
        - resources:
            kinds:
            - Pod
            selector:
              matchLabels:
                tier: frontend
      validate:
        message: "Frontend pods cannot access backend network directly"
        deny:
          conditions:
            any:
            - key: "{{ request.object.metadata.labels.tier }}"
              operator: Equals
              value: backend
    - name: require-network-labels
      match:
        any:
        - resources:
            kinds:
            - Pod
      exclude:
        any:
        - resources:
            namespaces:
            - kube-system
            - kyverno
      validate:
        message: "Pods must have network tier labels for segmentation"
        pattern:
          metadata:
            labels:
              tier: "frontend | backend | database"

#测试与验证

#测试主机网络访问(应失败)

cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
  name: test-host-network
spec:
  hostNetwork: true
  containers:
  - name: test
    image: nginx
EOF

#测试主机端口绑定(应失败)

cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
  name: test-host-port
spec:
  containers:
  - name: test
    image: nginx
    ports:
    - containerPort: 80
      hostPort: 8080
EOF

#测试 NodePort Service(应失败)

cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Service
metadata:
  name: test-nodeport
spec:
  type: NodePort
  ports:
  - port: 80
    targetPort: 80
    nodePort: 30080
  selector:
    app: test
EOF

#测试有效的网络配置(应通过)

cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
  name: test-secure-network
  labels:
    app: web-app
    tier: frontend
spec:
  dnsPolicy: ClusterFirst
  containers:
  - name: test
    image: nginx
    ports:
    - containerPort: 80
      protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
  name: test-service
spec:
  type: ClusterIP
  ports:
  - port: 80
    targetPort: 80
  selector:
    app: web-app
EOF