MiniKube
Install Minikube on ubuntu
https://minikube.sigs.k8s.io/docs/start/
Install minikube
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 sudo install minikube-linux-amd64 /usr/local/bin/minikube
Install Kubectl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
minikube start
Install on arch
Run PostgreSQL server and Pgadmin on minikube
Deploy Postgres
Create configuration file (.yaml)
- postgres-configuration.yaml
apiVersion: v1 kind: ConfigMap metadata: name: postgres-config labels: app: postgres data: POSTGRES_DB: postgresdb POSTGRES_USER: admin POSTGRES_PASSWORD: test123 --- 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: "IfNotPresent" ports: - containerPort: 5432 envFrom: - configMapRef: name: postgres-config volumeMounts: - mountPath: /var/lib/postgresql/data 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 <namefile>
Deploy Pgadmin
https://www.enterprisedb.com/blog/how-deploy-pgadmin-kubernetes
Create configuration file (.yaml)
- pgadmin-configuration.yaml
apiVersion: v1 kind: ConfigMap metadata: name: postgres-config labels: app: postgres data: POSTGRES_DB: postgresdb POSTGRES_USER: admin POSTGRES_PASSWORD: test123 --- 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: "IfNotPresent" ports: - containerPort: 5432 envFrom: - configMapRef: name: postgres-config volumeMounts: - mountPath: /var/lib/postgresql/data 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 <filename.yaml>
Connect pgadmin to server
minikube service <NamePgadminService>
- Login Pgadmin
- Server –> Properties
- Change host name/address to Postgres service name –> postgres
- 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