name: Byteverse Shecodes
apiVersion: v1
kind: Namespace
metadata:
  name: byteverse-shecodes
---
apiVersion: v1
kind: Service
metadata:
  name: apache-service
  namespace: byteverse-shecodes
spec:
  selector:
    app: apache-web
  ports:
  - name: http
    port: 80
    targetPort: 80
  type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: apache-deployment
  namespace: byteverse-shecodes
  labels:
    app: apache-web
spec:
  replicas: 2
  selector:
    matchLabels:
      app: apache-web
  template:
    metadata:
      labels:
        app: apache-web
    spec:
      containers:
      - name: apache-web
        image: httpd:2.4.46
        ports:
        - containerPort: 80
        volumeMounts:
        - name: config-volume
          mountPath: /usr/local/apache2/conf/httpd.conf
          subPath: httpd.conf
      volumes:
      - name: config-volume
        configMap:
          name: apache-config
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: apache-config
  namespace: byteverse-shecodes
data:
  httpd.conf: |-
    Listen 80
    ServerAdmin webmaster@localhost
    DocumentRoot /usr/local/apache2/htdocs
    <Directory /usr/local/apache2/htdocs>
        AllowOverride All
        Require all granted
    </Directory>
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: apache-ingress
  namespace: byteverse-shecodes
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - host: byteverseshecodes.soni-hetvihetvi.repl.co
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: apache-service
            port:
              name: http
