apiVersion: v1
kind: Namespace
metadata:
name: hw-test
labels:
name: hw-label-test
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: hw-test
name: hw-deployment
spec:
selector:
matchLabels:
app: helloworld
replicas: 2
template:
metadata:
labels:
app: helloworld
spec:
containers:
- name: helloworld
image: 192.168.190.130:5000/hello-world
ports:
- containerPort: 9080
---
apiVersion: v1
kind: Service
metadata:
namespace: hw-test
name: hw-service
spec:
selector:
app: helloworld
ports:
- protocol: TCP
port: 9080
targetPort: 9080
nodePort: 31080
type: NodePort
Kubernetes项目部署脚本1
最新推荐文章于 2025-12-17 23:11:06 发布
该文档描述了在Kubernetes环境中配置Namespace、Deployment和Service的过程。它定义了一个名为hw-test的Namespace,一个运行helloworld应用的Deployment,以及一个暴露在31080端口的NodePortService。
1765

被折叠的 条评论
为什么被折叠?



