tips:minikube

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
tips:minikube [2021/09/21 08:32] – created scipiotips:minikube [2021/09/28 14:42] (current) – [Install Minikube] scipio
Line 1: Line 1:
 ====== MiniKube ====== ====== MiniKube ======
 +
 +
 +
 +===== Install Minikube on ubuntu =====
 +
 +[[https://minikube.sigs.k8s.io/docs/start/]]
 +
 +**Install minikube**
 +
 +<code>
 +curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
 +sudo install minikube-linux-amd64 /usr/local/bin/minikube</code>
 +
 +**Install Kubectl**
 +
 +<code>
 +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
 +</code>
 +
 +<code>
 +minikube start
 +</code>
 +
 +
 +===== 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: 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
 +</code>
 +<code>kubectl apply -f <namefile></code>
 +
 +**Deploy Pgadmin**
 +
 +[[https://www.enterprisedb.com/blog/how-deploy-pgadmin-kubernetes]]
 +
 +Create configuration file (.yaml)
 +<code 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
 +</code>
 +
 +<code>
 +kubectl apply -f <filename.yaml>
 +</code>
 +
 +
 +**Connect pgadmin to server**
 +
 +<code>minikube service <NamePgadminService></code>
 +
 +  - 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
 +
 +
 +
 +
 +
 +
 +
  
  
  • tips/minikube.1632205962.txt.gz
  • Last modified: 2021/09/21 08:32
  • by scipio