guestbook-config.yaml

				
					apiVersion: v1
kind: Service
metadata:
  name: redis-master
  labels:
    app: guestbook
    tier: backend
    role: redis-master
spec:
  ports:
  - port: 6379
    targetPort: 6379
  selector:
    app: redis
    tier: backend
    role: master
---
apiVersion: apps/v1 #  for k8s versions before 1.9.0 use apps/v1beta2  and before 1.8.0 use extensions/v1beta1
kind: Deployment
metadata:
  name: redis-master
spec:
  selector:
    matchLabels:
      app: guestbook
      role: redis-master
      tier: backend
  replicas: 1
  template:
    metadata:
      labels:
        app: guestbook
        role: redis-master
        tier: backend
    spec:
      containers:
      - name: master
        image: k8s.gcr.io/redis:e2e  # or just image: redis
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
            ephemeral-storage: "650Mi"
        ports:
        - containerPort: 6379
---
apiVersion: v1
kind: Service
metadata:
  name: redis-slave
  labels:
    app: guestbook
    tier: backend
    role: redis-slave
spec:
  ports:
  - port: 6379
  selector:
    app: guestbook
    tier: backend
    role: redis-slave
---
apiVersion: apps/v1 #  for k8s versions before 1.9.0 use apps/v1beta2  and before 1.8.0 use extensions/v1beta1
kind: Deployment
metadata:
  name: redis-slave
spec:
  selector:
    matchLabels:
      app: guestbook
      role: redis-slave
      tier: backend
  replicas: 2
  template:
    metadata:
      labels:
        app: guestbook
        role: redis-slave
        tier: backend
    spec:
      containers:
      - name: slave
        image: gcr.io/google_samples/gb-redisslave:v1
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
            ephemeral-storage: "650Mi"
        env:
        - name: GET_HOSTS_FROM
          value: dns
          # If your cluster config does not include a dns service, then to
          # instead access an environment variable to find the master
          # service's host, comment out the 'value: dns' line above, and
          # uncomment the line below:
          # value: env
        ports:
        - containerPort: 6379
---
apiVersion: v1
kind: Service
metadata:
  name: guestbook-frontend
  labels:
    app: guestbook
    tier: frontend
spec:
  # if your cluster supports it, uncomment the following to automatically create
  # an external load-balanced IP for the frontend service.
  #type: LoadBalancer
  #externalIPs:
  #- xxx.xxx.xxx
  ports:
  - port: 80
  selector:
    app: guestbook
    tier: frontend
---
apiVersion: apps/v1 #  for k8s versions before 1.9.0 use apps/v1beta2  and before 1.8.0 use extensions/v1beta1
kind: Deployment
metadata:
  name: frontend
spec:
  selector:
    matchLabels:
      app: guestbook
      tier: frontend
  replicas: 1
  template:
    metadata:
      labels:
        app: guestbook
        tier: frontend
    spec:
      containers:
      - name: php-redis
        image: gcr.io/google-samples/gb-frontend:v4
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
            ephemeral-storage: "650Mi"
        env:
        - name: GET_HOSTS_FROM
          value: dns
          # If your cluster config does not include a dns service, then to
          # instead access environment variables to find service host
          # info, comment out the 'value: dns' line above, and uncomment the
          # line below:
          # value: env
        ports:
        - containerPort: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
   kubernetes.io/ingress.class: citrix
   ingress.citrix.com/frontend-ip: <VIP> # CS vServer IP
   # ingress.citrix.com/preconfigured-certkey: '{"certs": [ {"name": ""<server-cert>", "type": "default"} ] }' # predfined SSL cert
   ingress.citrix.com/insecure-termination: allow # allow = HTTP allowed, redirect = HTTP 2 HTTPS redirect, disallow = HTTPS only
   # ingress.citrix.com/frontend-sslprofile: "ns_default_ssl_profile_secure_frontend" # predefined frontend SSL profile
  name: guestbook-ingress
spec:
  # tls:
  # - hosts: # cert is predefined on ADC
  rules:
  - host: <hostname> # hostname check 
    http:
      paths:
      - backend:
          service:
            name: guestbook-frontend
            port:
              number: 80 # k8s Service Port
        path: /
        pathType: Prefix # startswith check