This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tips:minikube [2021/09/24 08:37] – scipio | tips:minikube [2021/09/28 14:42] (current) – [Install Minikube] scipio | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== MiniKube ====== | ====== MiniKube ====== | ||
| - | < | + | |
| - | paru -S kubectl | + | |
| + | ===== Install Minikube on ubuntu ===== | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | **Install minikube** | ||
| + | |||
| + | < | ||
| + | curl -LO https:// | ||
| + | sudo install minikube-linux-amd64 / | ||
| + | |||
| + | **Install Kubectl** | ||
| + | |||
| + | < | ||
| + | curl -LO " | ||
| + | sudo install -o root -g root -m 0755 kubectl / | ||
| </ | </ | ||
| + | |||
| + | < | ||
| + | minikube start | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Install on arch ===== | ||
| + | |||
| + | |||
| + | ==== Run PostgreSQL server and Pgadmin on minikube ==== | ||
| + | |||
| + | **Deploy Postgres** | ||
| + | |||
| + | Create configuration file (.yaml) | ||
| + | <code yaml postgres-configuration.yaml> | ||
| + | apiVersion: v1 | ||
| + | kind: ConfigMap | ||
| + | metadata: | ||
| + | name: postgres-config | ||
| + | labels: | ||
| + | app: postgres | ||
| + | data: | ||
| + | POSTGRES_DB: | ||
| + | POSTGRES_USER: | ||
| + | POSTGRES_PASSWORD: | ||
| + | | ||
| + | --- | ||
| + | |||
| + | apiVersion: apps/v1 | ||
| + | kind: Deployment | ||
| + | metadata: | ||
| + | name: postgres | ||
| + | spec: | ||
| + | replicas: 1 | ||
| + | selector: | ||
| + | matchLabels: | ||
| + | app: postgres | ||
| + | template: | ||
| + | metadata: | ||
| + | labels: | ||
| + | app: postgres | ||
| + | spec: | ||
| + | volumes: | ||
| + | - name: postgres-pv-storage | ||
| + | persistentVolumeClaim: | ||
| + | claimName: postgres-pv-claim | ||
| + | containers: | ||
| + | - name: postgres | ||
| + | image: postgres:12 | ||
| + | imagePullPolicy: | ||
| + | ports: | ||
| + | - containerPort: | ||
| + | envFrom: | ||
| + | - configMapRef: | ||
| + | name: postgres-config | ||
| + | volumeMounts: | ||
| + | - mountPath: / | ||
| + | name: postgres-pv-storage | ||
| + | |||
| + | --- | ||
| + | |||
| + | apiVersion: v1 | ||
| + | kind: Service | ||
| + | metadata: | ||
| + | name: postgres | ||
| + | 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 | ||
| + | </ | ||
| + | < | ||
| + | |||
| + | **Deploy Pgadmin** | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | Create configuration file (.yaml) | ||
| + | <code yaml pgadmin-configuration.yaml> | ||
| + | apiVersion: v1 | ||
| + | kind: ConfigMap | ||
| + | metadata: | ||
| + | name: postgres-config | ||
| + | labels: | ||
| + | app: postgres | ||
| + | data: | ||
| + | POSTGRES_DB: | ||
| + | POSTGRES_USER: | ||
| + | POSTGRES_PASSWORD: | ||
| + | | ||
| + | --- | ||
| + | |||
| + | apiVersion: apps/v1 | ||
| + | kind: Deployment | ||
| + | metadata: | ||
| + | name: postgres | ||
| + | spec: | ||
| + | replicas: 1 | ||
| + | selector: | ||
| + | matchLabels: | ||
| + | app: postgres | ||
| + | template: | ||
| + | metadata: | ||
| + | labels: | ||
| + | app: postgres | ||
| + | spec: | ||
| + | volumes: | ||
| + | - name: postgres-pv-storage | ||
| + | persistentVolumeClaim: | ||
| + | claimName: postgres-pv-claim | ||
| + | containers: | ||
| + | - name: postgres | ||
| + | image: postgres:12 | ||
| + | imagePullPolicy: | ||
| + | ports: | ||
| + | - containerPort: | ||
| + | envFrom: | ||
| + | - configMapRef: | ||
| + | name: postgres-config | ||
| + | volumeMounts: | ||
| + | - mountPath: / | ||
| + | name: postgres-pv-storage | ||
| + | |||
| + | --- | ||
| + | |||
| + | apiVersion: v1 | ||
| + | kind: Service | ||
| + | metadata: | ||
| + | name: postgres | ||
| + | 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** | ||
| + | |||
| + | < | ||
| + | |||
| + | - Login Pgadmin | ||
| + | - Server --> Properties | ||
| + | - Change host name/ | ||
| + | - Change username to one set in postgres config file --> admin | ||
| + | - Change port (if not default) to ContainerPort (not Minikube service port) --> 5432 | ||
| + | - Connect to server | ||
| + | |||
| + | |||
| + | |||
| + | |||