@bifos/nhncloud-cli 0.13.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,23 +8,22 @@ template 의 생성·삭제, workload 의 생성·변경(update/patch)·실행
8
8
  공통 UAK와 NCS appkey가 필요하다.
9
9
  인증은 Deploy 와 같은 UAK OAuth Bearer 토큰을 재사용한다(profile 토큰 캐시 공유).
10
10
 
11
- `nhncloud configure` (대화형 또는 `--ncs-appkey`) 로 설정하거나, `--app-key` 옵션으로 직접 넘긴다.
11
+ `nhncloud configure` (대화형 또는 `--ncs-appkey`) 로 설정한다.
12
12
 
13
13
  ```bash
14
- nhncloud ncs template list --app-key <appkey>
14
+ nhncloud ncs template list
15
15
  ```
16
16
 
17
- `--app-key <key>`는 profile의 `ncs.appkey`보다 우선한다.
18
17
  기본 region은 `kr1`이고, `kr1`, `kr3`만 지원한다(판교·광주).
19
18
 
20
19
  ## Template(설계도) 조회
21
20
 
22
21
  ```bash
23
- nhncloud ncs template list --app-key <appkey> --json
24
- nhncloud ncs template list --region kr3 --app-key <appkey> --json
25
- nhncloud ncs template get <template-id> --app-key <appkey> --json
26
- nhncloud ncs template version list <template-id> --app-key <appkey> --json
27
- nhncloud ncs template version get <template-id> <version> --app-key <appkey> --json
22
+ nhncloud ncs template list --json
23
+ nhncloud ncs template list --region kr3 --json
24
+ nhncloud ncs template get <template-id> --json
25
+ nhncloud ncs template version list <template-id> --json
26
+ nhncloud ncs template version get <template-id> <version> --json
28
27
  ```
29
28
 
30
29
  ## Template(설계도) 생성/삭제
@@ -33,33 +32,33 @@ nhncloud ncs template version get <template-id> <version> --app-key <appkey> --j
33
32
  삭제는 위험 명령이라 비대화형 환경에서 `--yes` 가 필수이고, TTY 에서는 확인 프롬프트가 뜬다.
34
33
 
35
34
  ```bash
36
- nhncloud ncs template create --file ./template-create.json --app-key <appkey>
37
- nhncloud ncs template delete <template-id> --yes --app-key <appkey>
35
+ nhncloud ncs template create --file ./template-create.json
36
+ nhncloud ncs template delete <template-id> --yes
38
37
  ```
39
38
 
40
39
  버전 생성도 동일하게 `--file` 을 쓰며, payload 의 `sourceVersion` 필드가 필수다(어느 버전을 기준으로 새 버전을 만들지 지정).
41
40
 
42
41
  ```bash
43
- nhncloud ncs template version create <template-id> --file ./version-create.json --app-key <appkey>
44
- nhncloud ncs template version delete <template-id> <version> --yes --app-key <appkey>
42
+ nhncloud ncs template version create <template-id> --file ./version-create.json
43
+ nhncloud ncs template version delete <template-id> <version> --yes
45
44
  ```
46
45
 
47
46
  ## Workload(런타임 실행) 조회
48
47
 
49
48
  ```bash
50
- nhncloud ncs workload list --app-key <appkey> --json
51
- nhncloud ncs workload list --q <워크로드 이름> --app-key <appkey> --json
52
- nhncloud ncs workload get <workload-id> --app-key <appkey> --json
49
+ nhncloud ncs workload list --json
50
+ nhncloud ncs workload list --q <워크로드 이름> --json
51
+ nhncloud ncs workload get <workload-id> --json
53
52
  ```
54
53
 
55
54
  컨테이너 로그와 이벤트는 특정 task 를 지정해야 한다.
56
55
  `--task`는 `workload get` 응답의 `tasks[].id`에서 얻는다.
57
56
 
58
57
  ```bash
59
- nhncloud ncs workload logs <workload-id> --task <task-id> --container <name> --app-key <appkey> --json
60
- nhncloud ncs workload logs <workload-id> --task <task-id> --container <name> --from 1h --to now --app-key <appkey>
61
- nhncloud ncs workload events <workload-id> --task <task-id> --app-key <appkey> --json
62
- nhncloud ncs workload events <workload-id> --task <task-id> --type Warning --app-key <appkey> --json
58
+ nhncloud ncs workload logs <workload-id> --task <task-id> --container <name> --json
59
+ nhncloud ncs workload logs <workload-id> --task <task-id> --container <name> --from 1h --to now
60
+ nhncloud ncs workload events <workload-id> --task <task-id> --json
61
+ nhncloud ncs workload events <workload-id> --task <task-id> --type Warning --json
63
62
  ```
64
63
 
65
64
  ### logs·events 시간 필터
@@ -102,9 +101,9 @@ AI 에이전트는 같은 입력으로 인증 재시도를 반복하지 말고
102
101
  실행 히스토리와 예약 실행 히스토리는 workload 단위로 조회한다.
103
102
 
104
103
  ```bash
105
- nhncloud ncs workload history <workload-id> --app-key <appkey> --json
106
- nhncloud ncs workload history get <workload-id> <history-id> --app-key <appkey> --json
107
- nhncloud ncs workload schedule-history <workload-id> --app-key <appkey> --json
104
+ nhncloud ncs workload history <workload-id> --json
105
+ nhncloud ncs workload history get <workload-id> <history-id> --json
106
+ nhncloud ncs workload schedule-history <workload-id> --json
108
107
  ```
109
108
 
110
109
  ## Workload 실행제어
@@ -112,10 +111,10 @@ nhncloud ncs workload schedule-history <workload-id> --app-key <appkey> --json
112
111
  일시정지·재개는 workload 단위, 재시작은 task 단위(`--task` 필수), 삭제는 위험 명령이라 `--yes` 필수(비대화형) 또는 확인 프롬프트(TTY)를 거친다.
113
112
 
114
113
  ```bash
115
- nhncloud ncs workload pause <workload-id> --app-key <appkey>
116
- nhncloud ncs workload resume <workload-id> --app-key <appkey>
117
- nhncloud ncs workload restart <workload-id> --task <task-id> --app-key <appkey>
118
- nhncloud ncs workload delete <workload-id> --yes --app-key <appkey>
114
+ nhncloud ncs workload pause <workload-id>
115
+ nhncloud ncs workload resume <workload-id>
116
+ nhncloud ncs workload restart <workload-id> --task <task-id>
117
+ nhncloud ncs workload delete <workload-id> --yes
119
118
  ```
120
119
 
121
120
  ## Workload 생성/변경
@@ -125,11 +124,11 @@ nhncloud ncs workload delete <workload-id> --yes --app-key <appkey>
125
124
  변경은 `update`(PUT, 전체 교체)와 `patch`(PATCH, JSON Patch 배열 부분 변경) 두 가지다.
126
125
 
127
126
  ```bash
128
- nhncloud ncs workload create --file ./workload-create.json --app-key <appkey> --json
129
- nhncloud ncs workload create --file ./workload-create.json --wait --timeout 600 --app-key <appkey> --json
127
+ nhncloud ncs workload create --file ./workload-create.json --json
128
+ nhncloud ncs workload create --file ./workload-create.json --wait --timeout 600 --json
130
129
 
131
- nhncloud ncs workload update <workload-id> --file ./workload-update.json --app-key <appkey> --json
132
- nhncloud ncs workload patch <workload-id> --file ./workload-patch.json --app-key <appkey> --json
130
+ nhncloud ncs workload update <workload-id> --file ./workload-update.json --json
131
+ nhncloud ncs workload patch <workload-id> --file ./workload-patch.json --json
133
132
  ```
134
133
 
135
134
  `patch`의 `--file`은 JSON Patch(RFC 6902) 배열이다.
@@ -146,20 +145,20 @@ nhncloud ncs workload patch <workload-id> --file ./workload-patch.json --app-key
146
145
  `historyId`는 `workload history` 목록 또는 `workload history get`의 `id`를 사용한다.
147
146
 
148
147
  ```bash
149
- nhncloud ncs malware config get --app-key <appkey> --json
150
- nhncloud ncs malware config set --enabled true --app-key <appkey>
151
- nhncloud ncs malware config set --enabled false --app-key <appkey>
148
+ nhncloud ncs malware config get --json
149
+ nhncloud ncs malware config set --enabled true
150
+ nhncloud ncs malware config set --enabled false
152
151
 
153
- nhncloud ncs malware result <workload-id> <history-id> --app-key <appkey> --json
152
+ nhncloud ncs malware result <workload-id> <history-id> --json
154
153
  ```
155
154
 
156
155
  ## 체이닝 예시
157
156
 
158
157
  ```bash
159
- nhncloud ncs template list --app-key <appkey> --json | jq -r '.[].id'
160
- nhncloud ncs workload list --app-key <appkey> --json | jq -r '.[] | select(.status=="Failed") | .id'
161
- nhncloud ncs workload get <workload-id> --app-key <appkey> --json | jq -r '.tasks[].id'
162
- nhncloud ncs workload history <workload-id> --app-key <appkey> --json | jq -r '.[0].id' # 최신 historyId
158
+ nhncloud ncs template list --json | jq -r '.[].id'
159
+ nhncloud ncs workload list --json | jq -r '.[] | select(.status=="Failed") | .id'
160
+ nhncloud ncs workload get <workload-id> --json | jq -r '.tasks[].id'
161
+ nhncloud ncs workload history <workload-id> --json | jq -r '.[0].id' # 최신 historyId
163
162
  ```
164
163
 
165
164
  ## 옵션
@@ -167,7 +166,6 @@ nhncloud ncs workload history <workload-id> --app-key <appkey> --json | jq -r '.
167
166
  | 옵션 | 설명 |
168
167
  |------|------|
169
168
  | `--region <region>` | NCS region. 기본 `kr1`. `kr1`·`kr3`만 지원 |
170
- | `--app-key <key>` | NCS appkey |
171
169
  | `--profile <name>` | 사용할 profile |
172
170
  | `--page <page>` / `--size <size>` | 페이지네이션 (기본 size는 명령별 상이 — `--help` 확인) |
173
171
  | `--q <query>` | workload list·events 필터 |
@@ -22,12 +22,19 @@ nhncloud nks nodegroup list <cluster> --json
22
22
  nhncloud nks cluster list --json
23
23
  nhncloud nks cluster get <cluster> --json
24
24
  nhncloud nks cluster events <cluster> --json
25
- nhncloud nks cluster event <cluster> <event> --json
25
+ nhncloud nks cluster event <cluster> <event-uuid> --json
26
26
  nhncloud nks cluster ipacl <cluster> --json
27
27
  nhncloud nks cluster kubeconfig <cluster>
28
28
  nhncloud nks cluster kubeconfig <cluster> --output ./kubeconfig
29
29
  ```
30
30
 
31
+ `events`는 `<cluster>`에 이름과 UUID를 모두 받는다.
32
+ NKS 이벤트 API 자체는 UUID만 받지만 CLI가 이름을 UUID로 해석한다.
33
+
34
+ `event` 단건 조회는 `events` 출력의 `uuid` 열 값을 넘긴다.
35
+ 정수 `id`로는 조회되지 않는다.
36
+ `details`는 표에서 줄여 보여 주므로 전문은 `--json`으로 본다.
37
+
31
38
  `kubeconfig`는 문자열을 stdout으로 출력하거나 `--output` 파일에 저장한다.
32
39
 
33
40
  ## Nodegroup 조회와 변경
@@ -42,13 +49,65 @@ nhncloud nks nodegroup stop-node <cluster> <nodegroup> --nodes node-1,node-2
42
49
  nhncloud nks nodegroup start-node <cluster> <nodegroup> --nodes node-1,node-2
43
50
  nhncloud nks nodegroup set-autoscale <cluster> <nodegroup> --file ./autoscale.json
44
51
  nhncloud nks nodegroup set-metric-autoscale <cluster> <nodegroup> --file ./metric-autoscale.json
45
- nhncloud nks nodegroup upgrade <cluster> <nodegroup> --version v1.30.1
52
+ nhncloud nks nodegroup upgrade <cluster> <nodegroup> --kube-version v1.31.4
46
53
  nhncloud nks nodegroup set-userscript <cluster> <nodegroup> --file ./userscript.sh
47
54
  nhncloud nks nodegroup update-flavor <cluster> <nodegroup> --flavor <flavor-uuid>
48
55
  nhncloud nks nodegroup set-fip-auto-bind <cluster> <nodegroup> --file ./fip-auto-bind.json
49
56
  nhncloud nks nodegroup set-labels <cluster> <nodegroup> --file ./labels.json
50
57
  ```
51
58
 
59
+ `upgrade` 는 control plane 업그레이드에도 쓴다. 아래 "Cluster 업그레이드" 를 본다.
60
+
61
+ ## Cluster 업그레이드
62
+
63
+ 클러스터 버전 업그레이드에 별도 명령은 없다.
64
+ `nodegroup upgrade` 하나로 control plane 과 워커를 모두 올린다.
65
+
66
+ ```bash
67
+ # 1. control plane — 노드그룹 이름을 default-master 로 지정한다
68
+ nhncloud nks nodegroup upgrade <cluster> default-master --kube-version v1.31.4
69
+
70
+ # 2. 워커 노드그룹 — 노드그룹마다 한 번씩 실행한다
71
+ nhncloud nks nodegroup upgrade <cluster> <nodegroup> --kube-version v1.31.4
72
+ ```
73
+
74
+ 순서는 정해져 있다.
75
+ control plane 을 먼저 올린 뒤에야 워커를 올릴 수 있다.
76
+
77
+ `default-master` 는 CLI 로 존재를 확인할 수 없다.
78
+
79
+ - `nodegroup list` 응답에 나오지 않는다.
80
+ - `nodegroup get <cluster> default-master` 는 403 으로 막혀 있다.
81
+
82
+ ### 업그레이드 대상 판단
83
+
84
+ 워커 노드그룹만 보면 최신인 것처럼 보인다.
85
+ control plane 이 먼저 올라가야 워커의 대상 버전이 생기기 때문이다.
86
+ 그래서 `cluster get` 의 `labels` 를 함께 본다.
87
+
88
+ | 조회 대상 | `kube_version_status` | `upgradable_kube_versions` |
89
+ |---|---|---|
90
+ | 워커 노드그룹 | `LATEST` | `[]` |
91
+ | 클러스터 | `NEED_K8S_UPGRADE` | `["v1.33.4"]` |
92
+
93
+ 위 값은 실측이다.
94
+ 공식 문서는 `kube_version_status` 의 값 목록을 정의하지 않으므로 다른 값이 올 수 있다.
95
+
96
+ ### 워커 업그레이드 중 서비스 영향 조절
97
+
98
+ 두 옵션은 워커 업그레이드에만 의미가 있고 기본값은 모두 1이다.
99
+
100
+ - `--num-buffer-nodes <n>`: 축출된 파드를 다시 받아 줄 여유 노드 수. 업그레이드가 끝나면 자동 삭제되지만 그동안 인스턴스 요금이 청구된다. 0으로 두면 기존 노드만으로 재배치해야 해 실패 위험이 커진다.
101
+ - `--num-max-unavailable-nodes <n>`: 한 번에 서비스 불가 상태로 둘 노드 수. 크게 잡으면 빨라지고 가용성이 낮아진다.
102
+
103
+ ### 사전 조건
104
+
105
+ - control plane 과 모든 워커 노드그룹의 Kubernetes 버전이 일치해야 한다.
106
+ - 마이너 버전 기준 한 단계씩만 올린다. 건너뛰기와 다운그레이드는 지원하지 않는다.
107
+ - 클러스터가 다른 작업으로 업데이트 중이면 업그레이드가 안 된다.
108
+ - NKS 레지스트리가 활성화되지 않은 클러스터는 업그레이드가 안 된다.
109
+ - 데몬셋 파드는 축출되지 않고, PodDisruptionBudget 설정 때문에 축출이 실패하면 업그레이드도 실패한다.
110
+
52
111
  ## Addon 조회와 변경
53
112
 
54
113
  ```bash
@@ -58,8 +117,8 @@ nhncloud nks addon list --k8s-version v1.30.1 --json
58
117
  nhncloud nks addon get <addon> --json
59
118
  nhncloud nks cluster addon list <cluster> --json
60
119
  nhncloud nks cluster addon get <cluster> <addon> --json
61
- nhncloud nks cluster addon install <cluster> --name coredns --version 1.0.0 --resolve-conflicts overwrite
62
- nhncloud nks cluster addon update <cluster> coredns --version 1.0.1 --resolve-conflicts preserve
120
+ nhncloud nks cluster addon install <cluster> --name coredns --addon-version 1.0.0 --resolve-conflicts overwrite
121
+ nhncloud nks cluster addon update <cluster> coredns --addon-version 1.0.1 --resolve-conflicts preserve
63
122
  nhncloud nks cluster addon remove <cluster> coredns --yes
64
123
  ```
65
124