k8s配置文件

apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    app: web
  name: web
spec:
  replicas: 1
  selector:
    matchLabels:
      app: web
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: web
    spec:
      containers:
      - image: registry.cn-hangzhou.aliyuncs.com/shiningrise/nginx:1.22.1
        name: nginx
        resources: {}
status: {}

---
apiVersion: v1
kind: Service
metadata:
  name: my-nodeport-service
  labels:
    app: web
spec:
  type: NodePort
  selector:
    app: web
  ports:
  - name: http
    port: 80
    targetPort: 80
    nodePort: 30001  # 可选,如果没有指定,Kubernetes 会自动分配

posted @ 2024-10-10 16:48  shiningrise  阅读(3)  评论(0编辑  收藏  举报
// 侧边栏目录 // https://blog-static.cnblogs.com/files/douzujun/marvin.nav.my1502.css