apps/site/site.yaml (view raw)
1apiVersion: networking.k8s.io/v1
2kind: Ingress
3metadata:
4 name: icyphox.sh
5 namespace: default
6 annotations:
7 caddy.ingress.kubernetes.io/permanent-redirect: "https://anirudh.fi"
8spec:
9 ingressClassName: caddy
10 rules:
11 - host: icyphox.sh
12 http:
13 paths:
14 - path: /
15 pathType: Prefix
16 backend:
17 service:
18 name: site
19 port:
20 number: 8080
21---
22apiVersion: networking.k8s.io/v1
23kind: Ingress
24metadata:
25 name: anirudh.fi
26 namespace: default
27spec:
28 ingressClassName: caddy
29 rules:
30 - host: anirudh.fi
31 http:
32 paths:
33 - path: /
34 pathType: Prefix
35 backend:
36 service:
37 name: site
38 port:
39 number: 8080
40
41---
42apiVersion: apps/v1
43kind: Deployment
44metadata:
45 name: site
46 labels:
47 app: site
48spec:
49 selector:
50 matchLabels:
51 app: site
52 template:
53 metadata:
54 labels:
55 app: site
56 spec:
57 nodeSelector:
58 kubernetes.io/hostname: sini
59 containers:
60 - name: site
61 image: nginx:latest
62 imagePullPolicy: IfNotPresent
63 volumeMounts:
64 - name: site
65 mountPath: /www
66 readOnly: false
67 - name: nginx-config
68 mountPath: /etc/nginx/nginx.conf
69 subPath: nginx.conf
70 ports:
71 - containerPort: 80
72 volumes:
73 - name: site
74 hostPath:
75 path: /var/www
76 - name: nginx-config
77 configMap:
78 name: site-nginx
79---
80apiVersion: v1
81kind: ConfigMap
82metadata:
83 name: site-nginx
84data:
85 nginx.conf: |
86 user nginx;
87 worker_processes 1;
88
89 error_log /var/log/nginx/error.log warn;
90 pid /var/run/nginx.pid;
91
92 events {
93 worker_connections 1024;
94 }
95
96 http {
97 include /etc/nginx/mime.types;
98 default_type application/octet-stream;
99
100 log_format main '$remote_addr - $remote_user [$time_local] "$request" '
101 '$status $body_bytes_sent "$http_referer" '
102 '"$http_user_agent" "$http_x_forwarded_for"';
103
104 access_log /var/log/nginx/access.log main;
105 sendfile on;
106
107 keepalive_timeout 65;
108
109 gzip on;
110
111 server {
112 listen 80;
113 server_name _;
114
115 location / {
116 root /www;
117 index index.html index.htm;
118 }
119 }
120 }
121---
122apiVersion: v1
123kind: Service
124metadata:
125 name: site
126spec:
127 selector:
128 app: site
129 ports:
130 - name: site-http
131 port: 8080
132 targetPort: 80
133