This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tips:minikube [2021/09/27 13:58] – rmontresor | tips:minikube [2021/09/28 14:42] (current) – [Install Minikube] scipio | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== MiniKube ====== | ====== MiniKube ====== | ||
| - | <code | download> | ||
| - | paru -S kubectl minikube kompose | ||
| - | </ | ||
| - | ==== Install Minikube ==== | ||
| - | [[https:// | + | ===== Install |
| - | + | ||
| - | === Install | + | |
| - | < | + | |
| - | === Install MiniKube === | + | [[https:// |
| - | < | + | **Install |
| - | sudo cp minikube-linux-amd64 / | + | |
| - | sudo chmod 755 / | + | |
| - | === Install | + | < |
| + | curl -LO https:// | ||
| + | sudo install minikube-linux-amd64 / | ||
| + | |||
| + | **Install Kubectl** | ||
| + | |||
| + | < | ||
| + | curl -LO " | ||
| + | sudo install -o root -g root -m 0755 kubectl / | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | minikube start | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Install | ||
| - | < | ||
| - | < | ||
| - | sudo mv ./kubectl / | ||
| - | check version --> kubectl version -o json | ||
| - | minikube start</ | ||
| ==== Run PostgreSQL server and Pgadmin on minikube ==== | ==== Run PostgreSQL server and Pgadmin on minikube ==== | ||
| Line 30: | Line 32: | ||
| **Deploy Postgres** | **Deploy Postgres** | ||
| - | - Create configuration file (.yaml) | + | Create configuration file (.yaml) |
| - | - kubectl apply -f < | + | <code yaml postgres-configuration.yaml> |
| - | - Create PersistenVolumeClaim file (.yaml) | + | apiVersion: v1 |
| - | - kubectl apply -f < | + | kind: ConfigMap |
| - | - Create deployment file (.yaml) | + | metadata: |
| - | - kubectl apply -f < | + | |
| - | - Create service file (.yaml) | + | |
| - | - kubectl apply -f <filename.yaml> | + | app: postgres |
| + | data: | ||
| + | POSTGRES_DB: | ||
| + | POSTGRES_USER: | ||
| + | POSTGRES_PASSWORD: | ||
| + | |||
| + | --- | ||
| + | |||
| + | apiVersion: apps/v1 | ||
| + | kind: Deployment | ||
| + | metadata: | ||
| + | | ||
| + | spec: | ||
| + | replicas: 1 | ||
| + | selector: | ||
| + | matchLabels: | ||
| + | app: postgres | ||
| + | template: | ||
| + | metadata: | ||
| + | labels: | ||
| + | app: postgres | ||
| + | spec: | ||
| + | volumes: | ||
| + | | ||
| + | persistentVolumeClaim: | ||
| + | claimName: postgres-pv-claim | ||
| + | containers: | ||
| + | - name: postgres | ||
| + | image: postgres: | ||
| + | imagePullPolicy: | ||
| + | ports: | ||
| + | - containerPort: | ||
| + | envFrom: | ||
| + | - configMapRef: | ||
| + | name: postgres-config | ||
| + | volumeMounts: | ||
| + | - mountPath: / | ||
| + | name: postgres-pv-storage | ||
| + | |||
| + | --- | ||
| + | |||
| + | apiVersion: v1 | ||
| + | kind: Service | ||
| + | metadata: | ||
| + | | ||
| + | labels: | ||
| + | app: postgres | ||
| + | spec: | ||
| + | type: NodePort | ||
| + | ports: | ||
| + | - port: 5432 | ||
| + | selector: | ||
| + | app: postgres | ||
| + | |||
| + | --- | ||
| + | |||
| + | apiVersion: v1 | ||
| + | kind: PersistentVolumeClaim | ||
| + | metadata: | ||
| + | | ||
| + | spec: | ||
| + | accessModes: | ||
| + | - ReadWriteOnce | ||
| + | resources: | ||
| + | requests: | ||
| + | storage: 100Mi | ||
| + | </ | ||
| + | < | ||
| **Deploy Pgadmin** | **Deploy Pgadmin** | ||
| Line 43: | Line 112: | ||
| [[https:// | [[https:// | ||
| - | - Create configuration file (.yaml) | + | Create configuration file (.yaml) |
| - | - kubectl apply -f <filename.yaml> | + | <code yaml pgadmin-configuration.yaml> |
| - | - Create service file (.yaml) | + | apiVersion: v1 |
| - | - kubectl apply -f < | + | kind: ConfigMap |
| - | - Create StatefulSet file (.yaml) | + | metadata: |
| - | - kubectl apply -f < | + | |
| + | | ||
| + | app: postgres | ||
| + | data: | ||
| + | POSTGRES_DB: | ||
| + | POSTGRES_USER: | ||
| + | POSTGRES_PASSWORD: | ||
| + | |||
| + | --- | ||
| + | |||
| + | apiVersion: apps/v1 | ||
| + | kind: Deployment | ||
| + | metadata: | ||
| + | | ||
| + | spec: | ||
| + | replicas: 1 | ||
| + | selector: | ||
| + | matchLabels: | ||
| + | app: postgres | ||
| + | template: | ||
| + | metadata: | ||
| + | labels: | ||
| + | app: postgres | ||
| + | spec: | ||
| + | volumes: | ||
| + | | ||
| + | persistentVolumeClaim: | ||
| + | claimName: postgres-pv-claim | ||
| + | containers: | ||
| + | - name: postgres | ||
| + | image: postgres: | ||
| + | imagePullPolicy: | ||
| + | ports: | ||
| + | - containerPort: | ||
| + | envFrom: | ||
| + | - configMapRef: | ||
| + | name: postgres-config | ||
| + | volumeMounts: | ||
| + | - mountPath: / | ||
| + | name: postgres-pv-storage | ||
| + | |||
| + | --- | ||
| + | |||
| + | apiVersion: v1 | ||
| + | kind: Service | ||
| + | metadata: | ||
| + | | ||
| + | labels: | ||
| + | app: postgres | ||
| + | spec: | ||
| + | type: NodePort | ||
| + | ports: | ||
| + | - port: 5432 | ||
| + | selector: | ||
| + | app: postgres | ||
| + | |||
| + | --- | ||
| + | |||
| + | apiVersion: v1 | ||
| + | kind: PersistentVolumeClaim | ||
| + | metadata: | ||
| + | name: postgres-pv-claim | ||
| + | spec: | ||
| + | accessModes: | ||
| + | - ReadWriteOnce | ||
| + | resources: | ||
| + | requests: | ||
| + | storage: 100Mi | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | kubectl apply -f < | ||
| + | </ | ||
| **Connect pgadmin to server** | **Connect pgadmin to server** | ||
| Line 56: | Line 198: | ||
| - Login Pgadmin | - Login Pgadmin | ||
| - Server --> Properties | - Server --> Properties | ||
| - | - Change host name/ | + | - Change host name/ |
| - | - Change username to one set in postgres config file | + | - Change username to one set in postgres config file --> admin |
| - | - Change port (if not default) to ContainerPort (not Minikube service port) | + | - Change port (if not default) to ContainerPort (not Minikube service port) --> 5432 |
| - Connect to server | - Connect to server | ||