minikube 설치

k8s 2024. 11. 19. 10:32

출처 : 도커

Ubuntu | Docker Docs

가상머신에 Minikube 설치하기 (with Docker)

 

 

 

 

 

 

sudo usermod -aG docker server && newgrp docker
wget https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb
sudo dpkg -i minikube_latest_amd64.deb
minikube start --driver=docker
curl -LO https://dl.k8s.io/release/v1.22.1/bin/linux/amd64/kubectl
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
kubectl --help
 
 

 

 

 

미니 쿠베 설치완료

 

 

cd  계정 홈디렉토리로 이동

환경변수 편집
vi .bashrc

알리랑스 입력
alias k='kubectl'


환경변수 재실행 
source .bashrc

 

 

 

 


server@ubuntu24:~$ k get pod -n kube-system
NAME                               READY   STATUS    RESTARTS        AGE
coredns-6f6b679f8f-5hh6q           1/1     Running   0               6m25s
etcd-minikube                      1/1     Running   0               6m33s
kube-apiserver-minikube            1/1     Running   0               6m33s
kube-controller-manager-minikube   1/1     Running   0               6m30s
kube-proxy-sb56h                   1/1     Running   0               6m26s
kube-scheduler-minikube            1/1     Running   0               6m33s
storage-provisioner                1/1     Running   2 (6m21s ago)   6m28s
server@ubuntu24:~$





server@ubuntu24:~$ k get nodes
NAME       STATUS   ROLES           AGE   VERSION
minikube   Ready    control-plane   10m   v1.31.0

server@ubuntu24:~$ k get all
NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP   11m

server@ubuntu24:~$ k get svc
NAME         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP   11m
server@ubuntu24:~$


server@ubuntu24:~$ k create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.10
deployment.apps/hello-minikube created

server@ubuntu24:~$ k expose deployment hello-minikube --type=NodePort --port=8080
service/hello-minikube exposed

server@ubuntu24:~$ k expose deployment hello-minikube --type=NodePort --port=8080
Error from server (AlreadyExists): services "hello-minikube" already exists

server@ubuntu24:~$ k expose deployment hello-minikube --type=nginx --port=80
The Service "hello-minikube" is invalid: spec.type: Unsupported value: "nginx": supported values: "ClusterIP", "ExternalName", "LoadBalancer", "NodePort"


server@ubuntu24:~$ k get all
NAME                                  READY   STATUS    RESTARTS   AGE
pod/hello-minikube-66fcf97965-n28d6   1/1     Running   0          2m11s

NAME                     TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
service/hello-minikube   NodePort    10.106.104.194   <none>        8080:30891/TCP   103s
service/kubernetes       ClusterIP   10.96.0.1        <none>        443/TCP          18m

NAME                             READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/hello-minikube   1/1     1            1           2m12s

NAME                                        DESIRED   CURRENT   READY   AGE
replicaset.apps/hello-minikube-66fcf97965   1         1         1       2m11s
server@ubuntu24:~$

server@ubuntu24:~$ k get svc
NAME             TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
hello-minikube   NodePort    10.106.104.194   <none>        8080:30891/TCP   112s
kubernetes       ClusterIP   10.96.0.1        <none>        443/TCP          18m
server@ubuntu24:~$



server@ubuntu24:~$ k get all
NAME                                  READY   STATUS    RESTARTS   AGE
pod/hello-minikube-66fcf97965-n28d6   1/1     Running   0          4m4s

NAME                     TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
service/hello-minikube   NodePort    10.106.104.194   <none>        8080:30891/TCP   3m36s
service/kubernetes       ClusterIP   10.96.0.1        <none>        443/TCP          20m

NAME                             READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/hello-minikube   1/1     1            1           4m5s

NAME                                        DESIRED   CURRENT   READY   AGE
replicaset.apps/hello-minikube-66fcf97965   1         1         1       4m4s
server@ubuntu24:~$ kubectl port-forward service/hello-minikube 8080:8080        Forwarding from 127.0.0.1:8080 -> 8080
Forwarding from [::1]:8080 -> 8080




활성화  외부 내부 연계
server@ubuntu24:~$ minikube addons enable ingress
* ingress is an addon maintained by Kubernetes. For any concerns contact minikube on GitHub.
You can view the list of minikube maintainers at: https://github.com/kubernetes/minikube/blob/master/OWNERS
  - Using image registry.k8s.io/ingress-nginx/controller:v1.11.2
  - Using image registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.4.3
  - Using image registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.4.3
* Verifying ingress addon...



server@ubuntu24:~$ k get service hello-minikube
NAME             TYPE       CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
hello-minikube   NodePort   10.106.104.194   <none>        8080:30891/TCP   13m
server@ubuntu24:~$
server@ubuntu24:~$
server@ubuntu24:~$ minikube service hello-minikube
|-----------|----------------|-------------|---------------------------|
| NAMESPACE |      NAME      | TARGET PORT |            URL            |
|-----------|----------------|-------------|---------------------------|
| default   | hello-minikube |        8080 | http://192.168.49.2:30891 |
|-----------|----------------|-------------|---------------------------|
* Opening service default/hello-minikube in default browser...
  http://192.168.49.2:30891






 

블로그 이미지

iesay

,

대용량 서비스 구축

aws 2024. 7. 31. 15:34

1. 앞단에 Cloudflare   proxy 기능은 월 25$ 지불하고 꼭 서야됨

    캐쉬에서   부하의 약 90% 처리 하도록 해야됨 

 

2.  EC2   GA  기능 활성화

 

3. REDIS 구축

 

4. Read Replicaion

 

5. RDS 파라메터 튜닝

 

 

 

'aws' 카테고리의 다른 글

자동 스트리지  (0) 2024.05.28
docker container logs 저장 CloudWatch  (0) 2024.05.07
AWS DMS Postgresql 마이그레이션  (0) 2024.03.25
AWS 보안성 향상  (0) 2024.02.13
AWS 요금 절약 방법  (0) 2024.02.07
블로그 이미지

iesay

,

fluent-bit , influxDB

Prometheus 2024. 7. 19. 15:23

 

docker-compose.yml

version: "3.9"
services:
  fluent-bit:
    image: fluent/fluent-bit:latest
    container_name: fluent-bit
    privileged: true
    user : root
    volumes:
      - /var/lib/docker/containers/:/docker-logs/:ro
      - ./fluent-bit.conf:/fluent-bit/etc/fluent-bit.conf
      - /home/ubuntu/fluent/output:/home/ubuntu/fluent/output

Docker Container Log 정확한 위치

 

 

fluent-bit.conf

[INPUT]
    name              tail
    Tag               node_metrics
    path              /docker-logs/*.log
    path_key         path
    multiline.parser  docker, cri
    Parser docker
    Docker_Mode  On

[SERVICE]
    Flush        1
    Parsers_File parsers.conf

[OUTPUT]
    Name          influxdb
    Match         *
    Host          호스트주소
    Port          8086
    Bucket        버킷명
    Org           조직아이디 0232313aaaa
    HTTP_Token    influxdb 토큰

OUTPUT  influxDB에 던지는 방법이다.

서버에 대한 부하도 굉장히 적다.

 

parsers.conf

[PARSER]
    Name        springboot
    Format      regex
    Regex       (?<time>\d{4}-\d{1,2}-\d{1,2} \d{1,2}:\d{1,2}:\d{1,2}.\d{1,3}) (?<level>[^ ]*) (?<number>\d*) --- (?<thread>\[[^ ]*) (?<logger>[^ ]*) *: (?<message>[^ ].*)$
    Time_Key    time
    Time_Format %Y-%m-%d %H:%M:%S.%L

[PARSER]
    Name         docker
    Format       json
    Time_Key     time
    Time_Format  %Y-%m-%dT%H:%M:%S.%L
    Time_Keep    On
    # Command      |  Decoder | Field | Optional Action
    # =============|==================|=================
    Decode_Field_As   escaped    log

[MULTILINE_PARSER]
    name          multiline-regex-test
    type          regex
    flush_timeout 1000
    #
    # Regex rules for multiline parsing
    # ---------------------------------
    #
    # configuration hints:
    #
    #  - first state always has the name: start_state
    #  - every field in the rule must be inside double quotes
    #
    # rules |   state name  | regex pattern                  | next state
    # ------|---------------|--------------------------------------------
    rule      "start_state"   "/([a-zA-Z]+ \d+ \d+\:\d+\:\d+)(.*)/"  "cont"
    rule      "cont"          "/^\s+at.*/"                     "cont"

[PARSER]
    Name named-capture-test
    Format regex
    Regex /^(?<date>[a-zA-Z]+ \d+ \d+\:\d+\:\d+) (?<message>.*)/m

한 디렉토리에 3개 파일 만들고 도커 컴포저 실행시키면 된다.

Agent 마다 각각 설치

 

Agent :  node -expoter  ,    fluent

그라파나 :  Prometheus ,  그라파나, influxdb 

node -expoter  Prometheus 수집

fluent(docker log)  influxdb  수집

 

둘다 그라파나에서 대쉬보드에서 보여준다.

 

 

 

influxdb  2 버전이상으로 해야지 관리자 페이지가 보인다.

docker-compose.yml

   version: '3'
services:
  influxdb:
    image: influxdb:2.7.7
    container_name: influx
    ports:
      - '8086:8086'
    environment:
      - INFLUXDB_ADMIN_ENABLED=true
      - INFLUXDB_ADMIN_USER=admin
      - INFLUXDB_ADMIN_PASSWORD=초기패스워드
    tty: true
    stdin_open: true
    volumes:
      - ./influx/config:/etc/influxdb
      - ./influxdb:/var/lib/influxdb

 

 

 

정규식으로 차차 분석 하면 될듯

 

 

 

 

 

 

'Prometheus' 카테고리의 다른 글

신규 설치 error  (0) 2024.04.18
Grafana 기초1  (0) 2021.11.10
블로그 이미지

iesay

,