完整的pod yaml,及關聯Service端口

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
        app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      imagePullSecrets:
        - name: registry-pull-152.148-harbor
      containers:
        - name: nginx
          image: 42.159.152.148/mydate/nginx:latest
          ports:
            - containerPort: 80

---

apiVersion: v1
kind: Service
metadata:
  name: nginx-service
  labels:
    app: nginx
spec:
  type: NodePort
  ports:
  - port: 80
    targetPort: 80
  selector:
    app: nginx


kubectl run nginx --image=nginx:latest --port=80 --replicas=3 --dry-run -o yaml > my-deployment.yaml
kubectl get deploy/nginx-deployment -o yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    run: nginx
  name: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      run: nginx
  template:
    metadata:
      labels:
        run: nginx
    spec:
      containers:
      - image: nginx:latest
        name: nginx
        ports:
        - containerPort: 80


kubectl explain pods.spec.containers   #pod容器的字段拼寫忘記了

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章