๐ก Apache HTTP Server on Kubernetes: Helm โ Executive Summary
Technical architectural analysis, practical configuration manifests, and deployment instructions for Apache HTTP Server on Kubernetes: Helm.
Informations
Using Chart Information
Exec
Create Yaml
yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: apache-htdocs
spec:
storageClassName: local-path
capacity:
storage: 8Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /home/apache/html
volumeMode: Filesystem
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: apache-htdocs-pvc
namespace: apache
spec:
storageClassName: local-path # Empty string must be explicitly set otherwise default StorageClass will be set
volumeName: apache-htdocs
accessModes:
- ReadWriteOnce
volumeMode: Filesystem
resources:
requests:
storage: 8Gi
Helm values.yaml Overwritten
bash
repo=bitnami
sdiff -s <(helm show values ${repo}/$(cat Chart.yaml | yq '.name') | yq -oprops) <(cat ./values.yaml | yq -oprops)
global.defaultStorageClass = | global.defaultStorageClass = local-path
htdocsPVC = | htdocsPVC = apache-htdocs-pvc
resourcesPreset = nano | resourcesPreset = none
service.type = LoadBalancer | service.type = NodePort
service.nodePorts.http = | service.nodePorts.http = 30980
service.nodePorts.https = | service.nodePorts.https = 30943
service.externalTrafficPolicy = Cluster | service.externalTrafficPolicy = Local
Apache httpd.conf Overwritten โ Handled by ingress
httpd.conf
xml
sdiff -s httpd.origin.conf httpd.conf
...
DocumentRoot "/opt/bitnami/apache/htdocs" DocumentRoot "/opt/bitnami/apache/htdocs"
<Directory "/opt/bitnami/apache/htdocs"> <Directory "/opt/bitnami/apache/htdocs">
...
Require all granted | #Require all granted
> Require ip 1.2.3.4 #ํ์ฉํ IP
</Directory> </Directory>
old
xml
sdiff -s httpd.origin.conf httpd.conf
...
#LoadModule remoteip_module modules/mod_remoteip.so | LoadModule remoteip_module modules/mod_remoteip.so
> # ์ ๋ขฐํ ํ๋ก์ IP (์: ingress ์ปจํธ๋กค๋ฌ IP, ํด๋ฌ์คํฐ ๊ฒ์ดํธ
> RemoteIPHeader X-Forwarded-For
> RemoteIPInternalProxy 10.42.0.0/16
...
DocumentRoot "/opt/bitnami/apache/htdocs" DocumentRoot "/opt/bitnami/apache/htdocs"
<Directory "/opt/bitnami/apache/htdocs"> <Directory "/opt/bitnami/apache/htdocs">
...
Require all granted | #Require all granted
> Require ip 1.2.3.4 #ํ์ฉํ IP
</Directory> </Directory>
...
<IfModule log_config_module> <IfModule log_config_module>
# #
# The following directives define some format nicknames f # The following directives define some format nicknames f
# a CustomLog directive (see below). # a CustomLog directive (see below).
# #
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{ LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{
LogFormat "%h %l %u %t \"%r\" %>s %b" common LogFormat "%h %l %u %t \"%r\" %>s %b" common
>
> <IfModule remoteip_module>
> LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"
> LogFormat "%a %l %u %t \"%r\" %>s %b" common
> </IfModule>
...
</IfModule> </IfModule>
Ingress
Troubleshoot
If an error occurs when definingCustom httpd.confโฆ
- Prerequisites
- There is a
filesdirectory in the chart, and if you customizehttpd.confhere, you can create and use a configmap.- But there is no sample to customize..
- If the file is not included, a default value
httpd.confis created within the container - Idea: Create default
httpd.confand import it outside the container - Install with an empty
filesdirectory
bash
helm install -n apache apache --create-namespace .
- default
httpd.confSave to chart
bash
k exec -it -n apache deployments/apache -- cat /opt/bitnami/apache/conf/httpd.conf > ./files/httpd.conf
- Reinstall after custom
bash
helm upgrade -n apache apache --create-namespace .
Features
Give download permission to all files in a specific directory
bash
cd /mnt/apache/html
chmod +r -R $mydir




Leave a Reply