├── .vscode └── settings.json ├── Readme.md ├── mongo-app.yaml ├── mongo-config.yaml ├── secret.yaml └── web-app.yaml /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "terminal.integrated.fontSize": 28 3 | } -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # commands that are used in this video. 2 | 3 | ``` 4 | brew install kubectl 5 | brew install minikube 6 | ``` 7 | ++++++++++++++++++++++++++++++++++++++ 8 | ``` 9 | minikube start 10 | kubectl get pod 11 | kubectl apply -f mongo-config.yaml 12 | kubectl apply -f secret.yaml 13 | kubectl apply -f mongo-app.yaml 14 | kubectl apply -f web-app.yaml 15 | kubectl get pod 16 | kubectl get configmap 17 | kubectl get secret 18 | kubectl get svc 19 | minikube ip 20 | kubectl get node -o wide 21 | ``` 22 | 23 | ``` 24 | minikube service webapp-service 25 | ``` 26 | ++++++++++++++++++++++++++++++++++++++ 27 | ``` 28 | kubectl delete deployment --all 29 | ``` 30 | ``` 31 | kubectl delete secret --all 32 | ``` 33 | -------------------------------------------------------------------------------- /mongo-app.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: mongo-deployment 5 | labels: 6 | app: mongo 7 | spec: 8 | replicas: 1 9 | selector: 10 | matchLabels: 11 | app: mongo 12 | template: 13 | metadata: 14 | labels: 15 | app: mongo 16 | spec: 17 | containers: 18 | - name: mongo 19 | image: mongo:5.0 20 | ports: 21 | - containerPort: 27017 22 | env: 23 | - name: MONGO_INITDB_ROOT_USERNAME 24 | valueFrom: 25 | secretKeyRef: 26 | name: mongo-secret 27 | key: mongo-user 28 | - name: MONGO_INITDB_ROOT_PASSWORD 29 | valueFrom: 30 | secretKeyRef: 31 | name: mongo-secret 32 | key: mongo-password 33 | 34 | --- 35 | 36 | apiVersion: v1 37 | kind: Service 38 | metadata: 39 | name: mongo-service 40 | spec: 41 | selector: 42 | app: mongo 43 | ports: 44 | - protocol: TCP 45 | port: 27017 46 | targetPort: 27017 47 | -------------------------------------------------------------------------------- /mongo-config.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: mongo-config 5 | data: 6 | mongo-url: mongo-service -------------------------------------------------------------------------------- /secret.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Secret 3 | metadata: 4 | name: mongo-secret 5 | type: Opaque 6 | data: 7 | mongo-user: bW9uZ291c2Vy 8 | mongo-password: bW9uZ29wYXNzd29yZA== -------------------------------------------------------------------------------- /web-app.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: webapp-deployment 5 | labels: 6 | app: webapp 7 | spec: 8 | replicas: 1 9 | selector: 10 | matchLabels: 11 | app: webapp 12 | template: 13 | metadata: 14 | labels: 15 | app: webapp 16 | spec: 17 | containers: 18 | - name: webapp 19 | image: mongo-express:latest 20 | ports: 21 | - containerPort: 8081 22 | env: 23 | - name: ME_CONFIG_MONGODB_SERVER 24 | valueFrom: 25 | configMapKeyRef: 26 | name: mongo-config 27 | key: mongo-url 28 | - name: ME_CONFIG_MONGODB_ADMINUSERNAME 29 | valueFrom: 30 | secretKeyRef: 31 | name: mongo-secret 32 | key: mongo-user 33 | - name: ME_CONFIG_MONGODB_ADMINPASSWORD 34 | valueFrom: 35 | secretKeyRef: 36 | name: mongo-secret 37 | key: mongo-password 38 | 39 | 40 | --- 41 | 42 | apiVersion: v1 43 | kind: Service 44 | metadata: 45 | name: webapp-service 46 | spec: 47 | type: NodePort 48 | selector: 49 | app: webapp 50 | ports: 51 | - protocol: TCP 52 | port: 8081 53 | targetPort: 8081 54 | nodePort: 30100 55 | --------------------------------------------------------------------------------