apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: mynapp-rs-aff-front
spec:
  replicas: 2
  selector:
    matchLabels:
      app: mynapp-rs-aff-front
      tier: frontend
  template:
    metadata:
      labels:
        app: mynapp-rs-aff-front
        tier: frontend
    spec:
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: tier
                operator: In
                values:
                - frontend
            topologyKey: "kubernetes.io/hostname"
        podAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: tier
                operator: In
                values:
                - cache 
            topologyKey: "kubernetes.io/hostname"
      containers:
      - name: mynapp
        image: c1t1d0s7/myweb
