我想确认一下是否可以在 Pod 中没有容器端口的情况下暴露 Service。在下面的示例中,Pod 没有容器端口,但是 Service 有定义端口:
apiVersion: v1
metadata:
name: mypod
namespace: ggckad-s8
labels:
app: mypod
spec:
volumes:
- name: log-volume
emptyDir: {}
containers:
- name: app
image: kubegoldenguide/question-29-app
volumeMounts:
- name: log-volume
mountPath: /var/log
kind: Service
apiVersion: v1
metadata:
name: mypod-service
namespace: ggckad-s8
spec:
type: NodePort
selector:
app: mypod
ports:
- port: 8000