ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [CoreOS] CoreOS 설치
    CoreOS 2015. 11. 14. 21:25

    Download

    https://coreos.com/os/docs/latest/booting-with-iso.html 경로에서 Stable 이미지를 다운로드 받아야합니다.

     Install

    이미지를 로드한 후 실행하면 콘솔화면이 나옵니다. CoreOS는 따로 설치 화면이 없고 ISO 파일로 부팅한 coreos-install 명령을 사용하여 하드디스크에 설치하는 방식입니다. (VirtualBox, VMWare 에서도 테스트가능합니다.)

    Step1

    https://discovery.etcd.io/new?size=3 URL를 접근하여 토큰을 발급받습니다.  size는 클러스터 숫자만큼 입력하시면 됩니다. 한대로 설정하고자 하면 1을 입력하면 됩니다. 기본적으로 Cluster의 기본은 3이기때문에 아래의 샘플에는 3으로 하였습니다.

    Step2

    ssh-rsa 기반으로 로그인 할 수 있게 하기 위한 설정입니다. 상황에 따라 Username 과 Password방식으로 수정할 수 있습니다. 아래의 명령어로 ssh-rsa키를 생성합니다.

    $ ssh-keygen -t rsa -c <사용자>
    Enter file in which to save the key (/home/user/.ssh/id_rsa): [저장할 경로를 입력합니다 (입력하지 않으면 기본으로 설정됩니다)] <return>
    Enter passphrase (empty for no passphrase): [SSH 키 비공개키를 입력합니다. 10~30글자 권장(입력하지 않아도 됩니다)] <Type the passphrase>
    Enter same passphrase again: <Type the passphrase>
    Your identification has been saved in /home/user/.ssh/id_rsa.
    Your public key has been saved in /home/user/.ssh/id_rsa.pub.
    The key fingerprint is: 0b:fa:3c:b8:73:71:bf:58:57:eb:2a:2b:8c:2f:4e:37

    Step3

    CoreOS 이미지파일 부팅 후 아래의 설정대로 cloud-config.yaml 파일을 생성합니다. cloud-config 의 자세한 옵션은 공식 문서 를 참고하세요

    #cloud-config
    
    ssh_authorized_keys:
      - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDN.... #/home/user/.ssh/id_rsa.pub 파일의 내용을 입력하세요.
    coreos:
      etcd2:
        # generate a new token for each unique cluster from https://discovery.etcd.io/new?size=3
        # specify the initial size of your cluster with ?size=X
        discovery: https://discovery.etcd.io/<token>
        # multi-region and multi-cloud deployments need to use $public_ipv4
        advertise-client-urls: http://<host_ip>:2379,http://<host_ip>:4001
        initial-advertise-peer-urls: http://<host_ip>:2380
        # listen on both the official ports and the legacy ports
        # legacy ports can be omitted if your application doesn't depend on them
        listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
        listen-peer-urls: http://<host_ip>:2380
      units:
        - name: etcd2.service
          command: start
        - name: fleet.service
          command: start
        - name: flanneld.service
          command: start
          drop-ins:
          - name: 50-network-config.conf
            content: |
              [Service]
              ExecStartPre=/usr/bin/etcdctl set /coreos.com/network/config '{"Network":"10.1.0.0/16", "Backend": {"Type": "vxlan"}}'
    
    

    Step4

    위의 파일을 저장하셨다면 아래의 명령어로 실제 설치를 진행하시면 됩니다.

    $ sudo coreos-install /dev/sda -C stable -c cloud-config.yaml

    Step5

    CoreOS를 Clustering 하시려면 위의 작업을 클러스터(Step1 의 size만큼) 할 노드만큼 반복해주세요. 

    Step6

    위의 작업이 끝나셨으면 재부팅해주세요.

    $ sudo reboot 

    참고


    댓글