vSphere with Tanzu on NSX-T: Part 11 – Demo Guestbook Application

vSphere with Tanzu on NSX-T: Part 11 – Demo Guestbook Application

This is part 11 of a series of videos discussing vSphere with Tanzu on NSX-T where I will demonstrate how to configure and operate vSphere with Tanzu on NSX-T. In this video we’ll look at the creation of a Demo Guestbook Application on vSphere with Tanzu and the realisation of NSX-T objects like Load Balancer, Network Policies, Tier-1 Gateway and Segments

frontend-deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: development-frontend
  labels:
    name: guestbook
    component: frontend
    environment: development
spec:
  selector:
    matchLabels:
      name: guestbook
      component: frontend
      environment: development
  replicas: 3
  template:
    metadata:
      labels:
        name: guestbook
        component: frontend
        environment: development
    spec:   
      containers:
      - name: guestbook
        image: 192.168.121.3/alpha/gb-frontend:latest
        # image: paulczar/gb-frontend:v5
        # image: gcr.io/google-samples/gb-frontend:v4
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
        env:
        - name: GET_HOSTS_FROM
          value: dns
        ports:
        - containerPort: 80

frontend-service.yaml

apiVersion: v1
kind: Service
metadata:
  name: frontend
  labels:
    name: guestbook
    component: frontend
spec:
  # if your cluster supports it, uncomment the following to automatically create
  # an external load-balanced IP for the frontend service.
  type: LoadBalancer
  ports:
  - port: 80
  selector:
    name: guestbook
    component: frontend

frontend-deployment.yaml

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: frontend-network-policy
spec:
  podSelector:
    matchLabels:
      name: guestbook
      component: frontend
  policyTypes:
  - Ingress
  ingress:
   - ports:
     - protocol: TCP
       port: 80

mongo-deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: mongo
  labels:
    name: mongo
    component: backend
spec:
  selector:
    matchLabels:
      name: mongo
      component: backend
  replicas: 1
  template:
    metadata:
      labels:
        name: mongo
        component: backend
    spec:
      containers:
      - name: mongo
        image: 192.168.121.3/alpha/mongo:latest
        # image: mongo:4.2
        args:
          - --bind_ip
          - 0.0.0.0
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
        ports:
        - containerPort: 27017

mongo-service.yaml

apiVersion: v1
kind: Service
metadata:
  name: mongo
  labels:
    name: mongo
    component: backend
spec:
  ports:
  - port: 27017
    targetPort: 27017
  selector:
    name: mongo
    component: backend

mongo-network-policy.yaml

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: mongo-network-policy
spec:
  podSelector:
    matchLabels:
      name: mongo
      component: backend
  policyTypes:
  - Ingress
  ingress:
   - ports:
     - protocol: TCP
       port: 27017

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *