Workload host port not specified
이 페이지는 아직 한국어로 제공되지 않습니다. 번역 작업 중입니다.
현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우
언제든지 연락주시기 바랍니다.Id: 2b1836f1-dcce-416e-8e16-da8c71920633
Cloud Provider: Kubernetes
Platform: Kubernetes
Severity: Low
Category: Networking and Firewall
Learn More
Description
Checks whether a Kubernetes workload defines a container port with a specified hostPort. It inspects both top-level pod specs and workload templates (spec.template.spec) for entries in containers and initContainers and reports any ports where hostPort is defined. Findings are reported as “IncorrectValue” because container port entries should not include hostPort.
Compliant Code Examples
apiVersion: v1
kind: Pod
metadata:
name: firstpod
spec:
containers:
- name: container
image: nginx
ports:
- containerPort: 80
hostIP: 10.0.0.1
Non-Compliant Code Examples
apiVersion: v1
kind: Pod
metadata:
name: firstpod
spec:
containers:
- name: container
image: nginx
ports:
- containerPort: 80
hostIP: 10.0.0.1
hostPort: 8080
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: secondpod
spec:
template:
spec:
containers:
- name: container2
image: nginx
ports:
- containerPort: 81
hostIP: 10.0.0.2
hostPort: 8081
metadata:
labels:
app: nginx
selector:
matchLabels:
app: nginx