위지원의 데이터 일기 🐈
Home
  • 분류 전체보기 (563)
    • ✎ 2025년 (4)
    • 2024년 (16)
    • 2023년 (6)
    • 2022년 (35)
      • Developement (22)
      • Error (9)
    • 2021년 (68)
      • ERROR (9)
      • 알고리즘 (11)
      • 개발공부 (21)
      • Data (15)
      • 21.下 (12)
    • 2020년 (164)
      • 코테 (84)
      • Development (29)
      • 정처기 (41)
    • 2019년 (27)
    • 2018년 (89)
      • English Speaking (8)
      • Error (12)
      • C, Java, FileSystem (13)
      • DataBase (15)
      • Java (2)
      • 지식 (16)
      • Go (3)
      • spark (9)
      • 영어 (5)
      • 알고리즘 (6)
    • 2017년 (143)
      • Error (17)
      • machine learning (16)
      • Spark (20)
      • Database (19)
      • Python (17)
      • Spring (9)
      • etc. (10)
      • 백준 (5)
      • Google Platform (12)
      • web Development (7)
      • Docker (3)
      • Linux (8)
Home
  • 분류 전체보기 (563)
    • ✎ 2025년 (4)
    • 2024년 (16)
    • 2023년 (6)
    • 2022년 (35)
      • Developement (22)
      • Error (9)
    • 2021년 (68)
      • ERROR (9)
      • 알고리즘 (11)
      • 개발공부 (21)
      • Data (15)
      • 21.下 (12)
    • 2020년 (164)
      • 코테 (84)
      • Development (29)
      • 정처기 (41)
    • 2019년 (27)
    • 2018년 (89)
      • English Speaking (8)
      • Error (12)
      • C, Java, FileSystem (13)
      • DataBase (15)
      • Java (2)
      • 지식 (16)
      • Go (3)
      • spark (9)
      • 영어 (5)
      • 알고리즘 (6)
    • 2017년 (143)
      • Error (17)
      • machine learning (16)
      • Spark (20)
      • Database (19)
      • Python (17)
      • Spring (9)
      • etc. (10)
      • 백준 (5)
      • Google Platform (12)
      • web Development (7)
      • Docker (3)
      • Linux (8)
블로그 내 검색
포트폴리오

위지원의 데이터 일기 🐈

데이터를 사랑하고 궁금해하는 기록쟁이입니다! 😉 Super Data Girl이 되는 그날까지🏃‍♀️ 화이팅!

  • 🖥 깃블로그
  • 🌍 위키원
  • 📑 내맘대로 스크랩
  • 💌 메일
  • 2021년/개발공부

    쿠버네티스 기초학습[클러스터 생성, 앱 배포]

    2021. 4. 6. 18:57

    by. 위지원

     

     

    Minikube를 사용해서 클러스터 생성하기

    목표 쿠버네티스 클러스터가 무엇인지 배운다. Minikube가 무엇인지 배운다. 온라인 터미널을 사용해서 쿠버네티스 클러스터를 시작한다. 쿠버네티스 클러스터 쿠버네티스는 컴퓨터들을 연결하

    kubernetes.io

    쿠버네티스 클러스터는 두 가지 형태의 자원으로 구성된다.

    • 컨트롤 플레인은 클러스터를 조율한다.
    • 노드는 애플리케이션을 구동하는 작업자(worker)이다.
    $ minikube start
    $ kubectl cluster-info
    Kubernetes master is running at https://127.0.0.1:64919
    KubeDNS is running at https://127.0.0.1:64919/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
    
    To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
    $ kubectl get nodes
    NAME       STATUS   ROLES                  AGE   VERSION
    minikube   Ready    control-plane,master   28m   v1.20.2

     

    디플로이먼트? .. 이걸 오 ㅐ또하는..? 그래도 다른게 있어서 그런거라 생각하고 따라가보겠다. 

    - 애플리케이션의 인스턴스를 어떻게 생성하고 업데이트하는 역할

    - 머신의 장애나 정비에 대응할 수 있는 자동 복구(self-healing) 메커니즘을 제공한다.

     

    terminal1

    아래 명령어를 이용해 디플로이먼트를 생성해준다.

    $ kubectl create deployment kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1
    deployment.apps/kubernetes-bootcamp created
    $ kubectl get deployments
    NAME                  READY   UP-TO-DATE   AVAILABLE   AGE
    kubernetes-bootcamp   0/1     1            0           14s

    아래의 작업들은 지난번에 알아본것과 동일하게.. 외부접속을 허용케 하는 작업이다.

    " By default they are visible from other pods and services within the same kubernetes cluster, but not outside that network. "

    아래 명령어를 이용해 프록시를 run해준다.

    $ echo -e "\n\n\n\e[92mStarting Proxy. After starting it will not output a response. 
    Please click the first Terminal Tab\n";
    kubectl proxy
    
    
    Starting Proxy. After starting it will not output a response. Please click the first 
    Terminal Tab
    
    Starting to serve on 127.0.0.1:8001
    curl http://localhost:8001/version
    " We now have a connection between our host (the online terminal) and the Kubernetes cluster. "

     

    terminal2

    지난번과 과정이 조금 다르긴하다. 

    # we can query the version directly through the API using the curl command:
    curl http://localhost:8001/version <<- 이게 쿼리날리는거다
    {
      "major": "1",
      "minor": "20",
      "gitVersion": "v1.20.2",
      "gitCommit": "faecb196815e248d3ecfb03c680a4507229c2a56",
      "gitTreeState": "clean",
      "buildDate": "2021-01-13T13:20:00Z",
      "goVersion": "go1.15.5",
      "compiler": "gc",
      "platform": "linux/amd64"
    }%

    아래의 명령어를 이용해 .. pod_name 환경변수에 설정을 해줄 수 있다..

    export POD_NAME=$(kubectl get pods -o go-template --template 
    '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
    echo Name of the Pod: $POD_NAME
    Name of the Pod: kubernetes-bootcamp-57978f5f5d-lql7c

    위에 뜬 주소로 가면 이와같이 확인이 가능하다.

    저작자표시 (새창열림)

    '2021년 > 개발공부' 카테고리의 다른 글

    쿠버네티스 예제: mongodb+kubernetes  (0) 2021.04.12
    Python decorator  (2) 2021.04.12
    minikube 설치 및 간단하게 사용하기  (0) 2021.04.06
    도커를 설치하고 컨테이너 실행하기  (0) 2021.04.02
    동적 타입 멈춰~! 파이썬의 타입힌팅  (4) 2021.03.23

    잠깐만요~! 읽으신김에 이런 글들은 어떠세요? 👀

    • 쿠버네티스 예제: mongodb+kubernetes 2021.04.12
    • Python decorator 2021.04.12
    • minikube 설치 및 간단하게 사용하기 2021.04.06
    • 도커를 설치하고 컨테이너 실행하기 2021.04.02
    맨 위로
전체 글 보기
Tistory 로그인
Tistory 로그아웃
로그아웃 글쓰기 관리

열정! 열정! 열정! 🔥

Designed by Nana
블로그 이미지
위지원
데이터 엔지니어로 근무 중에 있으며 데이터와 관련된 일을 모두 좋아합니다!. 특히 ETL 부분에 관심이 가장 크며 데이터를 빛이나게 가공하는 일을 좋아한답니다 ✨

티스토리툴바

티스토리툴바