Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kubernetes 4 #9

Merged
merged 5 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -448,3 +448,39 @@ kubectl apply -f ./kubernetes/reddit/ -n dev
![img.png](docs/img.png)
![img1.png](docs/img1.png)
P.S. Удалил инстанс кластера т.к. домашние задания проверяются долго, а потребление кластера на YC очень дорогое.

## Kubernetes-3
### Что было сделано:
1. Разобрался и подключил сущности Kubernetes:
- Ingress Controller
- Ingress
- Secret
- TLS
- LoadBalancer Service
- Network Policies
- PersistentVolumes
- PersistentVolumeClaims
2. Установил ingress nginx
```shell
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.8.2/deploy/static/provider/cloud/deploy.yaml
```
3. Защитил сервис с помощью TLS
```shell
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout tls.key -out tls.crt -subj "/CN=158.160.124.211"
kubectl create secret tls ui-ingress --key tls.key --cert tls.crt -n dev
```
4. Создал диск в ya.cloud
```shell
yc compute disk create \
--name k8s \
--size 4 \
--description "disk for k8s"
```

## Kubernetes-4
### Что было сделано:
1. Установил и настроил helm
2. Написал helm чарты для компонентов приложения
3. Разобрался с управлением зависимостями в helm
4. Установил Gitlab в Kubernetes
5. Настроил CI и выстроил пайплайн
1 change: 0 additions & 1 deletion gitlab-ci/.env.example

This file was deleted.

71 changes: 0 additions & 71 deletions gitlab-ci/.gitlab-ci.yml

This file was deleted.

15 changes: 0 additions & 15 deletions gitlab-ci/docker-compose.yml

This file was deleted.

9 changes: 9 additions & 0 deletions kubernetes/Charts/comment/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
apiVersion: v2
appVersion: "1.0.0"
name: comment
version: 1.0.0
description: OTUS reddit application COMMENT
maintainers:
- name: Baykanurov
email: [email protected]
3 changes: 3 additions & 0 deletions kubernetes/Charts/comment/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{- define "comment.fullname" -}}
{{- printf "%s-%s" .Release.Name .Chart.Name }}
{{- end -}}
34 changes: 34 additions & 0 deletions kubernetes/Charts/comment/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "comment.fullname" . }}
labels:
app: reddit
component: comment
release: {{ .Release.Name }}
spec:
replicas: 1
selector:
matchLabels:
app: reddit
component: comment
release: {{ .Release.Name }}
template:
metadata:
name: comment
labels:
app: reddit
component: comment
release: {{ .Release.Name }}
spec:
containers:
- image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
name: comment
ports:
- containerPort: {{ .Values.service.internalPort }}
name: comment
protocol: TCP
env:
- name: COMMENT_DATABASE_HOST
value: {{ .Values.databaseHost | default (printf "%s-mongodb" .Release.Name) }}
19 changes: 19 additions & 0 deletions kubernetes/Charts/comment/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
apiVersion: v1
kind: Service
metadata:
name: {{ template "comment.fullname" . }}
labels:
app: reddit
component: comment
release: {{ .Release.Name }}
spec:
type: ClusterIP
ports:
- port: {{ .Values.service.externalPort }}
protocol: TCP
targetPort: {{ .Values.service.internalPort }}
selector:
app: reddit
component: comment
release: {{ .Release.Name }}
10 changes: 10 additions & 0 deletions kubernetes/Charts/comment/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
service:
internalPort: 9292
externalPort: 9292

image:
repository: baykanurov/comment
tag: latest

databaseHost:
Loading
Loading