0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

KubernetesのYAMLファイルのデータセットを紹介!

Last updated at Posted at 2025-11-04

はじめに

CloudEval-YAML とは,手書きの質問コンテキスト,解答例,各問題の単体テストスクリプトの3つで構成されているデータセットである.データセットで異なるLLMの評価を行うことが可能である.
この記事では,Cloud-EvalYamlに含まれるYAMLファイルを実際にKubernetesで動かして,実際にリソースが起動するかを検証した.

主な特徴

  • データセット
    データセットはKubernetes,Envoy,lstioなどのアプリケーションを網羅する包括的なデータセットで構成されている.具体的には,手書きの質問コンテキスト,解答例,各問題の単体テストスクリプトの3つで構成されている.

  • ユースケース
    ベンチマークの目的は異なるLLMモデル(例:GPT-3.5)を比較するためである.

データセットのインストール方法

1.必要パッケージのインストール
▼アップデートする▼

c0a22103@c0a22103-practice:~/software2$ sudo apt update
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Fetched 114 kB in 1s (120 kB/s)
Reading package lists... Done

▼gitとunzipをインストールする▼

c0a22103@c0a22103-practice:~/software2$ sudo apt install -y git unzip
Reading package lists... Done
Building dependency tree       
Reading state information... Done
git is already the newest version (1:2.25.1-1ubuntu3.11).
unzip is already the newest version (6.0-25ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

▼kubectlをインストールする▼

2.リポジトリをクローン
▼git cloneする▼

c0a22103@c0a22103-practice:~/software2$ git clone https://github.com/alibaba/CloudEval-YAML.git
Cloning into 'CloudEval-YAML'...
remote: Enumerating objects: 120, done.
remote: Counting objects: 100% (120/120), done.
remote: Compressing objects: 100% (80/80), done.
remote: Total 120 (delta 40), reused 100 (delta 30), pack-reused 0
Receiving objects: 100% (120/120), 2.34 MiB | 3.00 MiB/s, done.
Resolving deltas: 100% (40/40), done.

3.data.zip を解凍
▼ディレクトリに移動する▼

c0a22103@c0a22103-practice:~/software2$ cd CloudEval-YAML

▼zipファイルを展開する▼

c0a22103@c0a22103-practice:~/software2/CloudEval-YAML$ unzip data.zip -d data
Archive:  data.zip
  inflating: data/task1.yaml
  inflating: data/task2.yaml
  inflating: data/task3.yaml
  ...
  inflating: data/metadata.json

データセットの解説

今回はdata/Kubernetes/pod/q5に保管されているデータセットを使用する

question.txtは手書きの質問コンテキストの例である.▼

  • 冒頭の2行では,質問文が記述されている.その下にはYAMLファイルが載っている.
  • 質問文を日本語で訳すと「次の YAML が与えられている.Pod 内に SPECIAL_LEVEL_KEY という名前の環境変数を定義し,valueFrom を使って special-config という設定ファイル内の SPECIAL_LEVEL の値を参照して、その環境変数を定義するのを手伝ってほしい.」という意味である.
question.txt
Given the following YAML, please help me define environment named SPECIAL_LEVEL_KEY in the Pod,
and use valueFrom to refer to the value of SPECIAL_LEVEL in the config file named special-config to define the environment variable of the Pod.
apiVersion: v1
kind: Pod
metadata:
   name: config-pod-1
spec:
   containers:
     - name: test-container
       image: mirror.gcr.io/library/busybox:latest
       command: [ "/bin/sh", "-c", "env" ]

labeled_code.yamlは解答例である. ▼
下記は質問文の解答となるYAMLファイルになる.

labeled_code.yaml
apiVersion: v1
kind: Pod
metadata:
   name: config-pod-1
spec:
   containers:
     - name: test-container
       image: mirror.gcr.io/library/busybox:latest
       command: [ "/bin/sh", "-c", "env" ]
       env:
         - name: SPECIAL_LEVEL_KEY
           valueFrom:
             configMapKeyRef:
               name: special-config
               key: SPECIAL_LEVEL

unit_test.shは各問題の単体テストスクリプトである.▼

unit_test.sh
kubectl delete configmap special-config
kubectl create configmap special-config --from-literal=SPECIAL_LEVEL=LevelValue
kubectl wait --for=condition=complete configmap/special-config  --timeout=5s
kubectl apply -f labeled_code.yaml
kubectl wait --for=condition=complete pods/config-pod-1  --timeout=30s
kubectl get pods config-pod-1
kubectl logs config-pod-1 | grep "SPECIAL_LEVEL_KEY=LevelValue" && echo cloudeval_unit_test_passed
# INCLUDE: "SPECIAL_LEVEL_KEY=LevelValue"

実際に動作させてみる

手書きの質問コンテキストに記述されているYAMLファイルをkubectl applyコマンドでPodを起動させようとした場合

▼kubectl applyコマンドの出力結果▼

  • kubectl applyコマンドの結果では,問題なく作成できている
c0a22103@c0a22103-practice:~/Qiita$ kubectl apply -f q5_pod.yaml
pod/config-pod-1 created

▼kubectl get podsコマンドの出力結果▼

  • kubectl get podsコマンドの結果では,STATUSとして問題なく終了している.
c0a22103@c0a22103-practice:~/CloudEvalYAML-Failed$ kubectl get pods
NAME           READY   STATUS      RESTARTS     AGE
config-pod-1   0/1     Completed   1 (2s ago)   6s

▼kubectl describeコマンドの結果▼

  • kubectl get podsコマンドの結果では,EventsのTypeでWarningが発生している.理由として,コンテナの起動に何度も失敗しているからである.
c0a22103@c0a22103-practice:~/CloudEvalYAML-Failed$ kubectl describe pod config-pod-1
Name:             config-pod-1
Namespace:        default
Priority:         0
Service Account:  default
Node:             c0a22103-worker1/192.168.100.231
Start Time:       Tue, 28 Oct 2025 07:40:35 +0000
Labels:           <none>
Annotations:      <none>
Status:           Running
IP:               10.42.1.5
IPs:
  IP:  10.42.1.5
Containers:
  test-container:
    Container ID:  containerd://0e31c1c4b2fff1df56fb5685a45e973181fd65e131034daa641b0b29ee3da845
    Image:         mirror.gcr.io/library/busybox:latest
    Image ID:      mirror.gcr.io/library/busybox@sha256:2f590fc602ce325cbff2ccfc39499014d039546dc400ef8bbf5c6ffb860632e7
    Port:          <none>
    Host Port:     <none>
    Command:
      /bin/sh
      -c
      env
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Tue, 28 Oct 2025 07:40:58 +0000
      Finished:     Tue, 28 Oct 2025 07:40:58 +0000
    Ready:          False
    Restart Count:  2
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-p4qt2 (ro)
Conditions:
  Type                        Status
  PodReadyToStartContainers   True
  Initialized                 True
  Ready                       False
  ContainersReady             False
  PodScheduled                True
Volumes:
  kube-api-access-p4qt2:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    Optional:                false
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason     Age                From               Message
  ----     ------     ----               ----               -------
  Normal   Scheduled  42s                default-scheduler  Successfully assigned default/config-pod-1 to c0a22103-worker1
  Normal   Pulled     39s                kubelet            Successfully pulled image "mirror.gcr.io/library/busybox:latest" in 3.797s (3.797s including waiting). Image size: 2223686 bytes.
  Normal   Pulled     38s                kubelet            Successfully pulled image "mirror.gcr.io/library/busybox:latest" in 694ms (694ms including waiting). Image size: 2223686 bytes.
  Normal   Pulling    21s (x3 over 42s)  kubelet            Pulling image "mirror.gcr.io/library/busybox:latest"
  Normal   Created    20s (x3 over 39s)  kubelet            Created container: test-container
  Normal   Started    20s (x3 over 39s)  kubelet            Started container test-container
  Normal   Pulled     20s                kubelet            Successfully pulled image "mirror.gcr.io/library/busybox:latest" in 744ms (744ms including waiting). Image size: 2223686 bytes.
  Warning  BackOff    7s (x4 over 37s)   kubelet            Back-off restarting failed container test-container in pod config-pod-1_default(9051e24f-f795-492c-8d42-ad695604f8c9)

解答例をkubectl applyコマンドでPodを起動させようとした場合

▼kubectl applyコマンドの出力結果▼

  • kubectl applyコマンドの結果では,問題なく作成できている
c0a22103@c0a22103-practice:~/Qiita$ kubectl apply -f labeled_code.yaml
pod/config-pod-1 created

▼kubectl get podsコマンドの出力結果▼

  • kubectl get podsコマンドの結果では,STATUSとしてCreateContainerConfigErrorが発生している.
c0a22103@c0a22103-practice:~/Qiita$ kubectl get pods
NAME           READY   STATUS                       RESTARTS   AGE
config-pod-1   0/1     CreateContainerConfigError   0          8s

▼kubectl describeコマンドの結果▼

  • kubectl get podsコマンドの結果では,EventsのTypeでWarningが発生している.理由として,special-configというConfigmapが見つからないからである.
c0a22103@c0a22103-practice:~/Qiita$ kubectl describe pod config-pod-1
Name:             config-pod-1
Namespace:        default
Priority:         0
Service Account:  default
Node:             c0a22103-worker1/192.168.100.209
Start Time:       Tue, 04 Nov 2025 01:51:10 +0000
Labels:           <none>
Annotations:      <none>
Status:           Pending
IP:               10.42.1.3
IPs:
  IP:  10.42.1.3
Containers:
  test-container:
    Container ID:
    Image:         mirror.gcr.io/library/busybox:latest
    Image ID:
    Port:          <none>
    Host Port:     <none>
    Command:
      /bin/sh
      -c
      env
    State:          Waiting
      Reason:       CreateContainerConfigError
    Ready:          False
    Restart Count:  0
    Environment:
      SPECIAL_LEVEL_KEY:  <set to the key 'SPECIAL_LEVEL' of config map 'special-config'>  Optional: false
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-crzwp (ro)
Conditions:
  Type                        Status
  PodReadyToStartContainers   True
  Initialized                 True
  Ready                       False
  ContainersReady             False
  PodScheduled                True
Volumes:
  kube-api-access-crzwp:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    Optional:                false
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason     Age               From               Message
  ----     ------     ----              ----               -------
  Normal   Scheduled  24s               default-scheduler  Successfully assigned default/config-pod-1 to c0a22103-worker1
  Normal   Pulled     20s               kubelet            Successfully pulled image "mirror.gcr.io/library/busybox:latest" in 3.619s (3.619s including waiting). Image size: 2224358 bytes.
  Normal   Pulled     19s               kubelet            Successfully pulled image "mirror.gcr.io/library/busybox:latest" in 809ms (809ms including waiting). Image size: 2224358 bytes.
  Normal   Pulling    6s (x3 over 24s)  kubelet            Pulling image "mirror.gcr.io/library/busybox:latest"
  Warning  Failed     5s (x3 over 20s)  kubelet            Error: configmap "special-config" not found
  Normal   Pulled     5s                kubelet            Successfully pulled image "mirror.gcr.io/library/busybox:latest" in 693ms (693ms including waiting). Image size: 2224358 bytes.

まとめ

解答例はPodが起動してRunningになることが必須ではないため,手書きの質問コンテキストに対して修正できているのかを判断する(※修正後のPodの状態は考慮していない)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?