top of page

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 Cluster - RBAC Examples

Creating Service Account Run the following command to add a new service account called king: $ kubectl create serviceaccount king serviceaccount/king created Find the name of the secret that stores t

Kubernetes - Role-based access control (RBAC)

Kubernetes RBAC The Kubernetes API provides access to sensitive data, including deployment details, persistent storage settings, and secrets. Over the years, the Kubernetes community has provided seve

Kubernetes Cheat Sheet

This page contains a list of commonly used kubectl commands and flags. Kubectl apply - Creating objects # create resource(s) kubectl apply -f ./my-manifest.yaml # create from multiple files kubectl a

Comments


bottom of page