Advertisement
rampz

Untitled

Nov 10th, 2019
496
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 3.23 KB | None | 0 0
  1. ---
  2. apiVersion: apps/v1
  3. kind: Deployment
  4. metadata:
  5.   labels:
  6.     run: app
  7.   name: app
  8. spec:
  9.   replicas: 2
  10.   selector:
  11.     matchLabels:
  12.       run: app
  13.   template:
  14.     metadata:
  15.       labels:
  16.         run: app
  17.     spec:
  18.       containers:
  19.       - name: nginx-deploy
  20.         image: nginx
  21.         ports:
  22.         - containerPort: 80
  23.  
  24. ---
  25. apiVersion: v1
  26. kind: Service
  27. metadata:
  28.   labels:
  29.     run: app
  30.   name: app
  31.   annotations:
  32.     haproxy.org/check: "enabled"
  33.     haproxy.org/forwarded-for: "enabled"
  34.     haproxy.org/load-balance: "roundrobin"
  35. spec:
  36.   selector:
  37.     run: app
  38.   ports:
  39.   - name: http
  40.     port: 80
  41.     protocol: TCP
  42.     targetPort: 80
  43.  
  44. ---
  45. apiVersion: v1
  46. kind: ConfigMap
  47. metadata:
  48.   name: haproxy-configmap
  49.   namespace: default
  50. data:
  51. ---
  52. apiVersion: apps/v1
  53. kind: Deployment
  54. metadata:
  55.   labels:
  56.     run: haproxy-ingress
  57.   name: haproxy-ingress
  58.   namespace: default
  59. spec:
  60.   replicas: 1
  61.   selector:
  62.     matchLabels:
  63.       run: haproxy-ingress
  64.   template:
  65.     metadata:
  66.       labels:
  67.         run: haproxy-ingress
  68.     spec:
  69.       serviceAccountName: haproxy-ingress-service-account
  70.       containers:
  71.       - name: haproxy-ingress
  72.         image: haproxytech/kubernetes-ingress
  73.         args:
  74.          - --configmap=default/haproxy-configmap
  75.           - --ingress-class=haproxy-ingress
  76.         ports:
  77.         - name: http
  78.           containerPort: 80
  79.  
  80. ---
  81. apiVersion: v1
  82. kind: Service
  83. metadata:
  84.   labels:
  85.     run: haproxy-ingress
  86.   name: haproxy-ingress
  87.   namespace: default
  88. spec:
  89.   selector:
  90.     run: haproxy-ingress
  91.   type: LoadBalancer
  92.   ports:
  93.   - name: http
  94.     port: 80
  95.     protocol: TCP
  96.     targetPort: 80
  97.  
  98. ---
  99. apiVersion: networking.k8s.io/v1beta1
  100. kind: Ingress
  101. metadata:
  102.   name: haproxy-ingress
  103.   annotations:
  104.     kubernetes.io/ingress.class: "haproxy-ingress"
  105.     ingress.kubernetes.io/ssl-redirect: "false"
  106.     ingress.kubernetes.io/app-root: "/"
  107.     ingress.kubernetes.io/rewrite-target: "/"
  108. spec:
  109.   rules:
  110.   - host: web-app.local
  111.     http:
  112.       paths:
  113.       - path: /
  114.         backend:
  115.           serviceName: app
  116.           servicePort: 80
  117.  
  118. ---
  119. apiVersion: v1
  120. kind: ServiceAccount
  121. metadata:
  122.   name: haproxy-ingress-service-account
  123.   namespace: default
  124.  
  125. ---
  126. kind: ClusterRole
  127. apiVersion: rbac.authorization.k8s.io/v1
  128. metadata:
  129.   name: haproxy-ingress-cluster-role
  130. rules:
  131. - apiGroups:
  132.  - ""
  133.   resources:
  134.  - configmaps
  135.   - endpoints
  136.   - nodes
  137.   - pods
  138.   - services
  139.   - namespaces
  140.   - events
  141.   - serviceaccounts
  142.   verbs:
  143.  - get
  144.   - list
  145.   - watch
  146. - apiGroups:
  147.  - "extensions"
  148.   resources:
  149.  - ingresses
  150.   - ingresses/status
  151.   verbs:
  152.  - get
  153.   - list
  154.   - watch
  155. - apiGroups:
  156.  - ""
  157.   resources:
  158.  - secrets
  159.   verbs:
  160.  - get
  161.   - list
  162.   - watch
  163.   - create
  164.   - patch
  165.   - update
  166. - apiGroups:
  167.  - extensions
  168.   resources:
  169.  - ingresses
  170.   verbs:
  171.  - get
  172.   - list
  173.   - watch
  174.  
  175. ---
  176. kind: ClusterRoleBinding
  177. apiVersion: rbac.authorization.k8s.io/v1
  178. metadata:
  179.   name: haproxy-ingress-cluster-role-binding
  180.   namespace: default
  181. roleRef:
  182.   apiGroup: rbac.authorization.k8s.io
  183.   kind: ClusterRole
  184.   name: haproxy-ingress-cluster-role
  185. subjects:
  186. - kind: ServiceAccount
  187.   name: haproxy-ingress-service-account
  188.   namespace: default
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement