k8s Quick-Start with Minikube
in blog on K8s, Minikube
minikube
Installation / Dashboard
minikube start
minikube dashboard
ArgoCD
Installation / Dashboard
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
minikube tunnel
minikube service argocd-server -n argocd
Get password (User: admin
)
argocd admin initial-password -n argocd
Harbor
add repo
helm repo add harbor https://helm.goharbor.io
helm repo list
fetch & unzip chart
helm fetch harbor/harbor
tar zxvf harbor-x.x.x.tgz
Download: values.yaml
expose type to loadBalancer
and tls disable
expose:
type: loadBalancer
ports:
httpPort: 80
tls:
enabled: false # true
Installation
kubectl create ns hb
helm install harbor -f values.yaml . -n hb
minikube tunnel
browse to http://localhost
id: admin
, password: Harbor12345
MinIO deploying with ArgoCD
git
repositories
https://github.com/pushdown99/argo-minio.git
apiVersion: apps/v1
kind: Deployment
metadata:
name: minio
spec:
replicas: 1
selector:
matchLabels:
app: minio
strategy:
type: Recreate
template:
metadata:
labels:
app: minio
spec:
volumes:
- name: storage
hostPath:
path: /data/minio
containers:
- name: minio
image: minio/minio:latest
args:
- server
- --console-address
- ":9001"
- "/storage"
env:
- name: MINIO_ROOT_USER
value: "minio"
- name: MINIO_ROOT_PASSWORD
value: "minio123"
- name: TZ
value: Asia/Seoul
- name: LANG
value: ko_KR.utf8
ports:
- containerPort: 9000
hostPort: 9000
- containerPort: 9001
hostPort: 9001
volumeMounts:
- name: storage
mountPath: "/storage"
---
apiVersion: v1
kind: Service
metadata:
name: minio
labels:
run: minio
spec:
type: NodePort
ports:
- port: 9000
targetPort: 9000
nodePort: 30333
name: api
- port: 9001
targetPort: 9001
nodePort: 30334
name: ui
selector:
app: minio
MinIO Application creation with ArgoCD
git
repositories
https://github.com/pushdown99/argo-minio.git
app/k8s-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: myweb
spec:
replicas: 2
selector:
matchLabels:
app: myweb
template:
metadata:
labels:
app: myweb
spec:
containers:
- name: myweb
image: pushdown99/myweb:latest
ports:
- containerPort: 3000
---
apiVersion: v1
kind: Service
metadata:
name: myweb-service
spec:
type: NodePort
selector:
app: myweb
ports:
- protocol: TCP
port: 3000
targetPort: 3000
nodePort: 30000
HOW-TO
- Login to ArgoCD
- Applications >
+ New APP
Fill-in
- (GENERAL) Application Name:
minio
- (GENERAL) Project Name:
default
- (SOURCE) Repository URL:
https://github.com/pushdown99/argo-minio.git
- (SOURCE) Path:
app
- (DESTINATION) Cluster URL:
https://kubernetes.default.svc
- (DESTINATION) Namespace:
default
- (GENERAL) Application Name:
Create
SYNC
kubectl
commands
kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 35m
minio NodePort 10.98.171.143 <none> 9000:30333/TCP,9001:30334/TCP 64s
kubectl port-forward svc/minio 9000:9000 9001:9001
browse to
http://127.0.0.1:9000
id:
minio
, password:minio123
CI/CD with ArgoCD
Sample Application with ArgoCD
https://github.com/pushdown99/cicd-node.git
app/k8s-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: myweb
spec:
replicas: 2
selector:
matchLabels:
app: myweb
template:
metadata:
labels:
app: myweb
spec:
containers:
- name: myweb
image: pushdown99/myweb:latest
ports:
- containerPort: 3000
---
apiVersion: v1
kind: Service
metadata:
name: myweb-service
spec:
type: NodePort
selector:
app: myweb
ports:
- protocol: TCP
port: 3000
targetPort: 3000
nodePort: 30000
HOW-TO
- Login to ArgoCD
- Applications >
+ New APP
Fill-in
- (GENERAL) Application Name:
myweb
- (GENERAL) Project Name:
default
- (SOURCE) Repository URL:
https://github.com/pushdown99/cicd-node.git
- (SOURCE) Path:
app
- (DESTINATION) Cluster URL:
https://kubernetes.default.svc
- (DESTINATION) Namespace:
default
- (GENERAL) Application Name:
Create
SYNC
kubectl
commands
kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 54m
minio NodePort 10.98.171.143 <none> 9000:30333/TCP,9001:30334/TCP 20m
myweb-service NodePort 10.104.220.233 <none> 3000:30000/TCP 14m
kubectl port-forward svc/myweb-service 3000:3000
- browse to
http://127.0.0.1:3000
Jenkins
Jenkins Installation with ArgoCD
https://github.com/pushdown99/argo-jenkins.git
HOW-TO
- Login to ArgoCD
- Applications >
+ New APP
Fill-in
- (GENERAL) Application Name:
jenkins
- (GENERAL) Project Name:
default
- (SOURCE) Repository URL:
https://github.com/pushdown99/argo-jenkins.git
- (SOURCE) Path:
app
- (DESTINATION) Cluster URL:
https://kubernetes.default.svc
- (DESTINATION) Namespace:
default
- (GENERAL) Application Name:
Create
SYNC
kubectl
commands
minikube service jenkins-service -n jenkins
|-----------|-----------------|-------------|---------------------------|
| NAMESPACE | NAME | TARGET PORT | URL |
|-----------|-----------------|-------------|---------------------------|
| jenkins | jenkins-service | 8080 | http://192.168.49.2:32000 |
|-----------|-----------------|-------------|---------------------------|
π jenkins-service μλΉμ€μ ν°λμ μμνλ μ€
|-----------|-----------------|-------------|------------------------|
| NAMESPACE | NAME | TARGET PORT | URL |
|-----------|-----------------|-------------|------------------------|
| jenkins | jenkins-service | | http://127.0.0.1:44853 |
|-----------|-----------------|-------------|------------------------|
π Opening service jenkins/jenkins-service in default browser...
β windows μμ Docker λλΌμ΄λ²λ₯Ό μ¬μ©νκ³ μκΈ° λλ¬Έμ, ν°λ―Έλμ μ΄μ΄μΌ μ€νν μ μμ΅λλ€
Find password for access page http://127.0.0.1:44853
kubectl get pod -n jenkins
NAME READY STATUS RESTARTS AGE
jenkins-6846f7864d-957b8 1/1 Running 0 2m8s
kubectl -n jenkins exec -it jenkins-6846f7864d-957b8 -- /bin/bash
jenkins@jenkins-6846f7864d-957b8:/$ cat /var/jenkins_home/secrets/initialAdminPassword
- browse to
http://127.0.0.1:44853
Nexus
Nexus Installation with ArgoCD
https://github.com/pushdown99/argo-nexus.git
HOW-TO
- Login to ArgoCD
- Applications >
+ New APP
Fill-in
- (GENERAL) Application Name:
nexus
- (GENERAL) Project Name:
default
- (SOURCE) Repository URL:
https://github.com/pushdown99/argo-nexus.git
- (SOURCE) Path:
app
- (DESTINATION) Cluster URL:
https://kubernetes.default.svc
- (DESTINATION) Namespace:
default
- (GENERAL) Application Name:
Create
SYNC
kubectl
commands
minikube service nexus-service -n nexus
|-----------|---------------|-------------|---------------------------|
| NAMESPACE | NAME | TARGET PORT | URL |
|-----------|---------------|-------------|---------------------------|
| nexus | nexus-service | 8081 | http://192.168.49.2:30100 |
|-----------|---------------|-------------|---------------------------|
π nexus-service μλΉμ€μ ν°λμ μμνλ μ€
|-----------|---------------|-------------|------------------------|
| NAMESPACE | NAME | TARGET PORT | URL |
|-----------|---------------|-------------|------------------------|
| nexus | nexus-service | | http://127.0.0.1:60009 |
|-----------|---------------|-------------|------------------------|
π Opening service nexus/nexus-service in default browser...
β windows μμ Docker λλΌμ΄λ²λ₯Ό μ¬μ©νκ³ μκΈ° λλ¬Έμ, ν°λ―Έλμ μ΄μ΄μΌ μ€νν μ μμ΅λλ€
Find password for access page http://127.0.0.1:60009
kubectl get pod -n nexus
NAME READY STATUS RESTARTS AGE
nexus-65b596bb55-rv47v 1/1 Running 0 5m34s
kubectl -n nexus exec -it nexus-65b596bb55-rv47v -- /bin/bash
bash-5.1$ cat /nexus-data/admin.password
- browse to
http://127.0.0.1:60009
Top
kubectl top node
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml