Deploy Multiple Apps to Kubernetes Cluster

Overview

  1. Prerequisites
  2. Append to hosts file
  3. Create Deployment.yml

Prerequisites

  1. Install Docker
  2. Install Kubectl
  3. Install Minikube

Fetch minikube IP

Append to Hosts File

echo "${MY-MINIKUBE_IP}	adminer.k8s.com" >> c:\Windows\System32\Drivers\etc\hosts
echo "${MY-MINIKUBE_IP}	kanban.k8s.com" >> c:\Windows\System32\Drivers\etc\hosts

Create Deployment.yml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: adminer
  labels:
    app: adminer
    group: db
spec:
  replicas: 1
  selector:
    matchLabels:
      app: adminer    # indicates which Pods (with which labeles) need be handled by this Deployment
  template:
    metadata:         # indicates the metadata that will be added to each Pod
      labels:
        app: adminer
        group: db
    spec:
      containers:     # defines a running container inside the Pod
        - name: adminer
          image: adminer:4.7.6-standalone
          ports:
            - containerPort: 8080   # which port of the container is exposed to the Pod
          env:
            - name: ADMINER_DESIGN
              value: pepa-linha
            - name: ADMINER_DEFAULT_SERVER
              value: postgres

Run adminer-deployment.yml

Verify adminer