FROM nginx:latest
MAINTAINER Vekov Ivan <i.vekov@v-halla.ru>
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
RUN find /etc/nginx/ -type f -exec sed -i 's/80/8000/g' {} +
RUN mkdir "/usr/share/nginx/html/health/"
RUN echo "{'status':'OK'}" > /usr/share/nginx/html/health/index.html
RUN mkdir "/usr/share/nginx/html/version/"
RUN echo "{'version':'0.1'}" > /usr/share/nginx/html/version/index.html
EXPOSE 8000
CMD ["nginx"]
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp-deployment
spec:
replicas: 2
selector:
matchLabels:
app: myapp
template:
metadata:
labels:
app: myapp
spec:
containers:
- name: myapp
image: ivekov/ivekov:latest
ports:
- name: web
containerPort: 8000
livenessProbe:
httpGet:
port: 8000
path: /health/
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 2
readinessProbe:
httpGet:
port: 8000
path: /health/
initialDelaySeconds: 10
periodSeconds: 5
apiVersion: v1
kind: Service
metadata:
name: myapp-service
spec:
selector:
app: myapp
ports:
- protocol: TCP
port: 80
targetPort: web
type: NodePort
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: myapp-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
rules:
- host: arch.homework
http:
paths:
- path: /test/ivekov($|/)(.*)
pathType: Prefix
backend:
service:
name: myapp-service
port:
number: 80
server {
listen 80;
server_name blog.zeroxzed.ru;
access_log /var/log/nginx/blog.zeroxzed.ru-access.log;
error_log /var/log/nginx/blog.zeroxzed.ru-error.log;
location / {
proxy_pass http://192.168.13.31;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
}
kubectl get ingress