top of page
Writer's pictureRex Andrew

Kubernetes Sample Yaml Files



Here the Sample Deployment and Service yaml file to deploy the application start pods in the existing node.




deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: king-app
spec:
  replicas: 
  selector:
    matchLabels:
      app: king-app
      tier: frontend
  template:
    metadata:
      labels:
        app: king-app
        tier: frontend
    spec:
      containers:
        - name: king-app-blog
          image: kingoncloud/kingblog:1.0
          ports:
            - containerPort: 8080

service.yaml

apiVersion: v1
kind: Service
metadata:
  name: king-app
spec:
  selector:
    app: king-app
    tier: frontend

  ports:
    - port: 80
      targetPort: 8080
  type: LoadBalancer



Here the sample single yaml which will have all resources.


king-app.yaml

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: king-app
spec:
  replicas: 
  selector:
    matchLabels:
      app: king-app
      tier: frontend
  template:
    metadata:
      labels:
        app: king-app
        tier: frontend
    spec:
      containers:
        - name: king-app-blog
          image: kingoncloud/kingblog:1.0
          ports:
            - containerPort: 8080
          
---
apiVersion: v1
kind: Service
metadata:
  name: king-app
spec:
  selector:
    app: king-app
    tier: frontend

  ports:
    - port: 80
      targetPort: 8080
  type: LoadBalancer

Kubernetes Cheat Sheet

This page contains a list of commonly used kubectl commands and flags. Kubectl apply - Creating objects # create resource(s) kubectl...

תגובות


bottom of page