study EKS no. 2
EKSクラスタ作成
EKSクラスタを一度削除したあと、再作成した。
PS C:\desk\AWS\eks> eksctl create cluster --name eks-dojo --region ap-northeast-1 --nodegroup-name node-group --node-type t3.medium --nodes 2 --nodes-min 0 --nodes-max 3 --managed 2025-09-21 22:52:49 [ℹ] eksctl version 0.175.0 (省略) 2025-09-21 23:06:00 [✔] EKS cluster "eks-dojo" in "ap-northeast-1" region is ready PS C:\desk\AWS\eks>
grafanaを構築
PS C:\desk\AWS\eks> kubectl apply -f .\grafana.yaml pod/grafana created PS C:\desk\AWS\eks>
IAMポリシーを作成
PowerShellで、実行する際に、ファイルを指定するのに、file://の指定が必要だった。
PS C:\desk\AWS\eks> aws iam create-policy --policy-name AWSLoadBalancerControllerIAMPolicy --policy-document file://iam-policy.json
{
"Policy": {
"PolicyName": "AWSLoadBalancerControllerIAMPolicy",
"PolicyId": "xxxxxx",
"Arn": "arn:aws:iam::xxxxx:policy/AWSLoadBalancerControllerIAMPolicy",
"Path": "/",
"DefaultVersionId": "v1",
"AttachmentCount": 0,
"PermissionsBoundaryUsageCount": 0,
"IsAttachable": true,
"CreateDate": "2025-09-21T14:51:45+00:00",
"UpdateDate": "2025-09-21T14:51:45+00:00"
}
}
PS C:\desk\AWS\eks>
ALB Ingress Controller の導入
ポリシー設定
PS C:\desk\AWS\eks> eksctl utils associate-iam-oidc-provider --region=ap-northeast-1 --cluster=eks-dojo 2025-09-21 23:55:05 [ℹ] (plan) would create IAM Open ID Connect provider for cluster "eks-dojo" in "ap-northeast-1" 2025-09-21 23:55:05 [!] no changes were applied, run again with '--approve' to apply the changes PS C:\desk\AWS\eks> PS C:\desk\AWS\eks> eksctl utils associate-iam-oidc-provider --region=ap-northeast-1 --cluster=eks-dojo --approve 2025-09-21 23:55:30 [ℹ] will create IAM Open ID Connect provider for cluster "eks-dojo" in "ap-northeast-1" 2025-09-21 23:55:30 [✔] created IAM Open ID Connect provider for cluster "eks-dojo" in "ap-northeast-1" PS C:\desk\AWS\eks>
PS C:\desk\AWS\eks> eksctl create iamserviceaccount --cluster eks-dojo --namespace kube-system --name aws-load-balancer-controller --attach-policy-arn arn:aws:iam::<AWSアカウントID>:policy/AWSLoadBalancerControllerIAMPolicy --approve 2025-09-21 23:56:50 [ℹ] 1 iamserviceaccount (kube-system/aws-load-balancer-controller) was included (based on the include/exclude rules) (省略) 2025-09-21 23:57:20 [ℹ] created serviceaccount "kube-system/aws-load-balancer-controller" PS C:\desk\AWS\eks>
ALB Controller をHelmでインストール
PS C:\desk\AWS\eks> helm repo add eks https://aws.github.io/eks-charts "eks" already exists with the same configuration, skipping PS C:\desk\AWS\eks> PS C:\desk\AWS\eks> helm repo list NAME URL eks https://aws.github.io/eks-charts PS C:\desk\AWS\eks> PS C:\desk\AWS\eks> helm repo update Hang tight while we grab the latest from your chart repositories... ...Successfully got an update from the "eks" chart repository Update Complete. ⎈Happy Helming!⎈ PS C:\desk\AWS\eks>
PS C:\desk\AWS\eks> helm install aws-load-balancer-controller eks/aws-load-balancer-controller -n kube-system --set clusterName=eks-dojo --set serviceAccount.create=false --set serviceAccount.name=aws-load-balancer-controller --set region=ap-northeast-1 --set vpcId=<VPC-ID> NAME: aws-load-balancer-controller LAST DEPLOYED: Sun Sep 21 00:03:23 2025 NAMESPACE: kube-system STATUS: deployed REVISION: 1 TEST SUITE: None NOTES: AWS Load Balancer controller installed! PS C:\desk\AWS\eks> PS C:\desk\AWS\eks> kubectl.exe -n kube-system get pod NAME READY STATUS RESTARTS AGE aws-load-balancer-controller-64cd88544b-6kkfn 1/1 Running 0 55s aws-load-balancer-controller-64cd88544b-w8xfp 1/1 Running 0 55s aws-node-g2jfj 2/2 Running 0 59m aws-node-mkb6q 2/2 Running 0 59m coredns-676bf68468-npjrk 1/1 Running 0 64m coredns-676bf68468-tqns7 1/1 Running 0 64m kube-proxy-tr2zx 1/1 Running 0 59m kube-proxy-xrgjh 1/1 Running 0 59m PS C:\desk\AWS\eks>
Ingressリソースを作成する。
PS C:\desk\AWS\eks> kubectl.exe apply -f .\grafana-svc.yaml service/grafana-service created PS C:\desk\AWS\eks> PS C:\desk\AWS\eks> kubectl.exe apply -f .\grafana-ingress.yaml Warning: annotation "kubernetes.io/ingress.class" is deprecated, please use 'spec.ingressClassName' instead ingress.networking.k8s.io/grafana-ingress created PS C:\desk\AWS\eks>
ロードバランサーにターゲットグループが設定されていなかった。
ingressを作成することによって、ターゲットグループは自動で設定されるものらしい。
これは、前回と違って、helm installする際に、適用するバージョンを指定しなかったことが影響した様子。
PS C:\desk\AWS\eks> kubectl get targetgroupbindings -A No resources found PS C:\desk\AWS\eks>
調べるとポリシーが不足しているようだ。以下をポリシーに追加した。
{
"Effect": "Allow",
"Action": [
"elasticloadbalancing:DescribeListenerAttributes",
"elasticloadbalancing:ModifyListenerAttributes"
],
"Resource": "*"
}
再起動して、適用する。
PS C:\desk\AWS\eks> kubectl -n kube-system rollout restart deploy/aws-load-balancer-controller deployment.apps/aws-load-balancer-controller restarted PS C:\desk\AWS\eks> PS C:\desk\AWS\eks> kubectl -n kube-system rollout status deploy/aws-load-balancer-controller Waiting for deployment "aws-load-balancer-controller" rollout to finish: 1 out of 2 new replicas have been updated... Waiting for deployment "aws-load-balancer-controller" rollout to finish: 1 out of 2 new replicas have been updated... Waiting for deployment "aws-load-balancer-controller" rollout to finish: 1 out of 2 new replicas have been updated... Waiting for deployment "aws-load-balancer-controller" rollout to finish: 1 old replicas are pending termination... Waiting for deployment "aws-load-balancer-controller" rollout to finish: 1 old replicas are pending termination... deployment "aws-load-balancer-controller" successfully rolled out PS C:\desk\AWS\eks>
以下が作成された。
PS C:\desk\AWS\eks> kubectl get targetgroupbindings -A NAMESPACE NAME SERVICE-NAME SERVICE-PORT TARGET-TYPE AGE default k8s-default-grafanas-9d9e908bbd grafana-service 3000 ip 3m55s PS C:\desk\AWS\eks>
Grafanaの画面を参照することができた。
study EKS
AWS CLIとkubectlをインストール
初心者でも分かる!EKS道場【Day2】AWS CLI・kubectl・eksctlをインストールせよ!~道具を揃える~ #コンテナ技術 - Qiita
インストールする。
> msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi > winget install -e --id Kubernetes.kubectl > winget install --id=eksctl.eksctl -e
確認した。
> aws --version aws-cli/2.30.1 Python/3.13.7 Windows/11 exe/AMD64 > > kubectl version --client Client Version: v1.34.1 Kustomize Version: v5.7.1 > > eksctl version 0.175.0 >
クラスタ作成
初心者でも分かる!EKS道場【Day3】EKSクラスタを構築せよ!~道場を建てる~ #AWS - Qiita
クラスタ作成した
> eksctl create cluster --name eks-dojo --region ap-northeast-1 --nodegroup-name node-group --node-type t3.medium --nodes 2 --nodes-min 0 --nodes-max 3 --managed > kubectl get nodes NAME STATUS ROLES AGE VERSION ip-192-168-29-178.ap-northeast-1.compute.internal Ready <none> 3m49s v1.29.15-eks-3abbec1 ip-192-168-46-91.ap-northeast-1.compute.internal Ready <none> 3m49s v1.29.15-eks-3abbec1 >
Pod
初心者でも分かる!EKS道場【Day4】EKSクラスタにPodをデプロイ!~魂を宿す~ #AWS - Qiita
> kubectl apply -f .\grafana.yaml pod/grafana created > kubectl apply -f .\grafana-service.yaml service/grafana-service created >
> kubectl get pods NAME READY STATUS RESTARTS AGE grafana 1/1 Running 0 4m21s > > kubectl get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE grafana-service NodePort 10.100.121.180 <none> 80:30080/TCP 4m42s kubernetes ClusterIP 10.100.0.1 <none> 443/TCP 3h52m >
ALB Ingress Controller の導入
初心者でも分かる!EKS道場【Day5】EKSのサービス公開!ロードバランサーで世界へ解き放て! #AWS - Qiita
IAMポリシー作成。コマンドからはエラーになった。webコンソールから作成した。
> aws iam create-policy --policy-name AWSLoadBalancerControllerIAMPolicy --policy-document iam-policy.json An error occurred (MalformedPolicyDocument) when calling the CreatePolicy operation: Syntax errors in policy. >
IAM ServiceAccount を作成がエラーになった。
> eksctl create iamserviceaccount --cluster eks-dojo --namespace kube-system --name aws-load-balancer-controller --attach-policy-arn arn:aws:iam::<AWSアカウントID>:policy/AWSLoadBalancerControllerIAMPolicy --approve 2025-09-15 05:30:58 [!] no IAM OIDC provider associated with cluster, try 'eksctl utils associate-iam-oidc-provider --region=ap-northeast-1 --cluster=eks-dojo' Error: unable to create iamserviceaccount(s) without IAM OIDC provider enabled >
コメントの通りにeksctl utils associate-iam-oidc-providerを実行した。
> eksctl utils associate-iam-oidc-provider --region=ap-northeast-1 --cluster=eks-dojo
2025-09-15 05:32:58 [ℹ] (plan) would create IAM Open ID Connect provider for cluster "eks-dojo" in "ap-northeast-1"
2025-09-15 05:32:58 [!] no changes were applied, run again with '--approve' to apply the changes
>
> eksctl utils associate-iam-oidc-provider --region=ap-northeast-1 --cluster=eks-dojo --approve
2025-09-15 05:33:25 [ℹ] will create IAM Open ID Connect provider for cluster "eks-dojo" in "ap-northeast-1"
2025-09-15 05:33:25 [✔] created IAM Open ID Connect provider for cluster "eks-dojo" in "ap-northeast-1"
>
> eksctl create iamserviceaccount --cluster eks-dojo --namespace kube-system --name aws-load-balancer-controller --attach-policy-arn arn:aws:iam::<AWSアカウントID>:policy/AWSLoadBalancerControllerIAMPolicy --approve
2025-09-15 05:33:38 [ℹ] 1 iamserviceaccount (kube-system/aws-load-balancer-controller) was included (based on the include/exclude rules)
2025-09-15 05:33:38 [!] serviceaccounts that exist in Kubernetes will be excluded, use --override-existing-serviceaccounts to override
2025-09-15 05:33:38 [ℹ] 1 task: {
2 sequential sub-tasks: {
create IAM role for serviceaccount "kube-system/aws-load-balancer-controller",
create serviceaccount "kube-system/aws-load-balancer-controller",
} }2025-09-15 05:33:38 [ℹ] building iamserviceaccount stack "eksctl-eks-dojo-addon-iamserviceaccount-kube-system-aws-load-balancer-controller"
2025-09-15 05:33:38 [ℹ] deploying stack "eksctl-eks-dojo-addon-iamserviceaccount-kube-system-aws-load-balancer-controller"
2025-09-15 05:33:38 [ℹ] waiting for CloudFormation stack "eksctl-eks-dojo-addon-iamserviceaccount-kube-system-aws-load-balancer-controller"
2025-09-15 05:34:08 [ℹ] waiting for CloudFormation stack "eksctl-eks-dojo-addon-iamserviceaccount-kube-system-aws-load-balancer-controller"
2025-09-15 05:34:08 [ℹ] created serviceaccount "kube-system/aws-load-balancer-controller"
>
helmをインストール
> winget install --id=Helm.Helm -e
> helm version
version.BuildInfo{Version:"v3.19.0", GitCommit:"3d8990f0836691f0229297773f3524598f46bda6", GitTreeState:"clean", GoVersion:"go1.24.7"}
>
helmを実行
> helm repo add eks https://aws.github.io/eks-charts "eks" has been added to your repositories > helm repo update Hang tight while we grab the latest from your chart repositories... ...Successfully got an update from the "eks" chart repository Update Complete. ⎈Happy Helming!⎈ >
> helm install aws-load-balancer-controller eks/aws-load-balancer-controller -n kube-system --set clusterName=eks-dojo --set serviceAccount.create=false --set serviceAccount.name=aws-load-balancer-controller --set region=ap-northeast-1 --set vpcId=<VPC-ID> --set image.tag="v2.6.1" NAME: aws-load-balancer-controller LAST DEPLOYED: Tue Sep 15 05:46:18 2025 NAMESPACE: kube-system STATUS: deployed REVISION: 1 TEST SUITE: None NOTES: AWS Load Balancer controller installed! >
以下の、path部分を修正した。
> kubectl -n kube-system get deploy aws-load-balancer-controller -o yaml
readinessProbe:
failureThreshold: 2
httpGet:
path: /readyz # ここを/healthzに修正した。
port: 61779
scheme: HTTP
> kubectl -n kube-system edit deploy aws-load-balancer-controller
deployment.apps/aws-load-balancer-controller edited
> kubectl -n kube-system rollout restart deploy aws-load-balancer-controller
deployment.apps/aws-load-balancer-controller restarted
>
ServiceをClusterIPに修正。
> kubectl apply -f .\grafana-svc.yaml service/grafana-service created > > kubectl get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE grafana-service ClusterIP 10.100.169.161 <none> 3000/TCP 4s kubernetes ClusterIP 10.100.0.1 <none> 443/TCP 5h32m >
Ingressを設定
> kubectl apply -f .\grafana-ingress.yaml Warning: annotation "kubernetes.io/ingress.class" is deprecated, please use 'spec.ingressClassName' instead ingress.networking.k8s.io/grafana-ingress created >
Worker Nodeを停止。
一時停止する。
> eksctl scale nodegroup --cluster eks-dojo --name node-group --nodes 0
Ubuntu設定
デフォルトのエディターをVIMに変更した。
user01@test101:~$ ls -l /usr/bin/editor lrwxrwxrwx 1 root root 24 Aug 27 2024 /usr/bin/editor -> /etc/alternatives/editor user01@test101:~$ ls -l /etc/alternatives/editor lrwxrwxrwx 1 root root 9 Aug 27 2024 /etc/alternatives/editor -> /bin/nano user01@test101:~$ user01@test101:~$ sudo update-alternatives --set editor /usr/bin/vim.basic update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/editor (editor) in manual mode user01@test101:~$
.vimrcを設定
user01@test101:~$ cat ~/.vimrc set number set ignorecase set smartcase user01@test101:~$
bash for command
bash for command
$ for cnt in $(seq 1 1000); do echo "-----" $cnt "-----" ; date ; curl http://localhost:8080; echo ""; sleep 1 ; done
Kubernetes resources
Kubernetes resources
$ kubectl version Client Version: v1.30.3 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3 Server Version: v1.30.0 $ $ kubectl api-resources NAME SHORTNAMES APIVERSION NAMESPACED KIND bindings v1 true Binding componentstatuses cs v1 false ComponentStatus configmaps cm v1 true ConfigMap endpoints ep v1 true Endpoints events ev v1 true Event limitranges limits v1 true LimitRange namespaces ns v1 false Namespace nodes no v1 false Node persistentvolumeclaims pvc v1 true PersistentVolumeClaim persistentvolumes pv v1 false PersistentVolume pods po v1 true Pod podtemplates v1 true PodTemplate replicationcontrollers rc v1 true ReplicationController resourcequotas quota v1 true ResourceQuota secrets v1 true Secret serviceaccounts sa v1 true ServiceAccount services svc v1 true Service mutatingwebhookconfigurations admissionregistration.k8s.io/v1 false MutatingWebhookConfiguration validatingadmissionpolicies admissionregistration.k8s.io/v1 false ValidatingAdmissionPolicy validatingadmissionpolicybindings admissionregistration.k8s.io/v1 false ValidatingAdmissionPolicyBinding validatingwebhookconfigurations admissionregistration.k8s.io/v1 false ValidatingWebhookConfiguration customresourcedefinitions crd,crds apiextensions.k8s.io/v1 false CustomResourceDefinition apiservices apiregistration.k8s.io/v1 false APIService controllerrevisions apps/v1 true ControllerRevision daemonsets ds apps/v1 true DaemonSet deployments deploy apps/v1 true Deployment replicasets rs apps/v1 true ReplicaSet statefulsets sts apps/v1 true StatefulSet selfsubjectreviews authentication.k8s.io/v1 false SelfSubjectReview tokenreviews authentication.k8s.io/v1 false TokenReview localsubjectaccessreviews authorization.k8s.io/v1 true LocalSubjectAccessReview selfsubjectaccessreviews authorization.k8s.io/v1 false SelfSubjectAccessReview selfsubjectrulesreviews authorization.k8s.io/v1 false SelfSubjectRulesReview subjectaccessreviews authorization.k8s.io/v1 false SubjectAccessReview horizontalpodautoscalers hpa autoscaling/v2 true HorizontalPodAutoscaler cronjobs cj batch/v1 true CronJob jobs batch/v1 true Job certificatesigningrequests csr certificates.k8s.io/v1 false CertificateSigningRequest leases coordination.k8s.io/v1 true Lease endpointslices discovery.k8s.io/v1 true EndpointSlice events ev events.k8s.io/v1 true Event flowschemas flowcontrol.apiserver.k8s.io/v1 false FlowSchema prioritylevelconfigurations flowcontrol.apiserver.k8s.io/v1 false PriorityLevelConfiguration ingressclasses networking.k8s.io/v1 false IngressClass ingresses ing networking.k8s.io/v1 true Ingress networkpolicies netpol networking.k8s.io/v1 true NetworkPolicy runtimeclasses node.k8s.io/v1 false RuntimeClass poddisruptionbudgets pdb policy/v1 true PodDisruptionBudget clusterrolebindings rbac.authorization.k8s.io/v1 false ClusterRoleBinding clusterroles rbac.authorization.k8s.io/v1 false ClusterRole rolebindings rbac.authorization.k8s.io/v1 true RoleBinding roles rbac.authorization.k8s.io/v1 true Role priorityclasses pc scheduling.k8s.io/v1 false PriorityClass csidrivers storage.k8s.io/v1 false CSIDriver csinodes storage.k8s.io/v1 false CSINode csistoragecapacities storage.k8s.io/v1 true CSIStorageCapacity storageclasses sc storage.k8s.io/v1 false StorageClass volumeattachments storage.k8s.io/v1 false VolumeAttachment $
アイコンを作成する際に指定可能なデザインを聞いてみた
ChatGPTに聞いてみた。
以下、回答。
アイコンのデザインには、多様なスタイルや指針が存在します。以下に一般的なデザインの種類をいくつか挙げます。
マテリアルデザイン (Material Design): Googleが提唱するデザイン言語で、シャドウ、動き、深さの概念を用いてより直感的でタッチフレンドリーなインターフェースを実現します。
フラットデザイン (Flat Design): テクスチャ、グラデーション、シャドウを排除したシンプルなデザイン。クリーンでミニマリスティックな外観が特徴です。
ニューモーフィズム (Neumorphism): ソフトな内部シャドウと外部シャドウを組み合わせて、ページ上でオブジェクトが浮かび上がっているように見せるデザイン手法です。
スケウモーフィズム (Skeuomorphism): リアルなテクスチャや影を用いて、アイコンが現実世界の物体のように見えるようにデザインする手法。リアリズムを追求します。
アウトラインデザイン (Outline Design): アイコンや要素が輪郭線で描かれ、シンプルかつ洗練された外観を持ちます。軽やかで開放的な印象を与えます。
グラデーションデザイン (Gradient Design): 色彩のグラデーションを利用して、アイコンに深みや立体感を持たせるデザイン。鮮やかで目を引く効果があります。
ピクセルアート (Pixel Art): 小さなピクセルを一つ一つ配置してデザインを作り上げる手法。レトロな雰囲気を演出できます。
これらはアイコンをデザインする際の基本的なスタイルの一部ですが、プロジェクトの目的やブランドのアイデンティティに応じて、これらのスタイルを組み合わせたり、独自の要素を加えたりすることで、ユニークなアイコンを作成することが可能です。
KVM with cloud-init
CentOS 8 VM Image
[root@pm01 images]# wget https://cloud.centos.org/centos/8/x86_64/images/CentOS-8-GenericCloud-8.2.2004-20200611.2.x86_64.qcow2
[root@pm01 ~]# qemu-img info images/CentOS-8-GenericCloud-8.2.2004-20200611.2.x86_64.qcow2
image: images/CentOS-8-GenericCloud-8.2.2004-20200611.2.x86_64.qcow2
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 1.1G
cluster_size: 65536
Format specific information:
compat: 0.10
[root@pm01 ~]#
[root@pm01 ~]# cp -vp images/CentOS-8-GenericCloud-8.2.2004-20200611.2.x86_64.qcow2 /var/lib/libvirt/images/vm05.qcow2 ‘images/CentOS-8-GenericCloud-8.2.2004-20200611.2.x86_64.qcow2’ -> ‘/var/lib/libvirt/images/vm05.qcow2’ [root@pm01 ~]#
I resize VM Image from 10G to 20G.
[root@pm01 ~]# cd /var/lib/libvirt/images/ [root@pm01 images]# qemu-img resize vm05.qcow2 20G Image resized. [root@pm01 images]#
prepare for cloud-init
I get hashed pass by python command like below.
[root@pm01 images]# python -c 'import crypt,getpass; print(crypt.crypt(getpass.getpass(), crypt.mksalt(crypt.METHOD_SHA512)))' Password: <input password> <hashed pass> [root@pm01 images]#
I create cloud-confg file.
This file makes hostname "testnode" and creates "centos" user in a VM.
[root@pm01 images]# vi config.yaml
[root@pm01 images]# cat config.yaml
#cloud-config
fqdn: testnode
users:
- name: centos
groups: wheel
lock_passwd: false
passwd: '<hashed pass>'
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
[root@pm01 images]#
[root@pm01 images]# yum install -y cloud-utils *snip* Installed: cloud-utils.x86_64 0:0.27-20.el7.centos Dependency Installed: cloud-utils-growpart.noarch 0:0.29-5.el7 euca2ools.noarch 0:3.4.1-1.el7 python-lxml.x86_64 0:3.2.1-4.el7 python-progressbar.noarch 0:2.3-4.el7 python-requestbuilder.noarch 0:0.7.1-1.el7 rsync.x86_64 0:3.1.2-10.el7 Complete! [root@pm01 images]#
I generate config.iso file by cloud-localds command.
[root@pm01 images]# cloud-localds config.iso config.yaml wrote config.iso with filesystem=iso9660 and diskformat=raw [root@pm01 images]#
Unfortunantly, I could not find "CentOS 8".
[root@pm01 images]# osinfo-query os | grep -i centos centos5.0 | CentOS 5.0 | 5.0 | http://centos.org/centos/5.0 centos5.1 | CentOS 5.1 | 5.1 | http://centos.org/centos/5.1 centos5.10 | CentOS 5.10 | 5.10 | http://centos.org/centos/5.10 centos5.11 | CentOS 5.11 | 5.11 | http://centos.org/centos/5.11 centos5.2 | CentOS 5.2 | 5.2 | http://centos.org/centos/5.2 centos5.3 | CentOS 5.3 | 5.3 | http://centos.org/centos/5.3 centos5.4 | CentOS 5.4 | 5.4 | http://centos.org/centos/5.4 centos5.5 | CentOS 5.5 | 5.5 | http://centos.org/centos/5.5 centos5.6 | CentOS 5.6 | 5.6 | http://centos.org/centos/5.6 centos5.7 | CentOS 5.7 | 5.7 | http://centos.org/centos/5.7 centos5.8 | CentOS 5.8 | 5.8 | http://centos.org/centos/5.8 centos5.9 | CentOS 5.9 | 5.9 | http://centos.org/centos/5.9 centos6.0 | CentOS 6.0 | 6.0 | http://centos.org/centos/6.0 centos6.1 | CentOS 6.1 | 6.1 | http://centos.org/centos/6.1 centos6.10 | CentOS 6.10 | 6.10 | http://centos.org/centos/6.10 centos6.2 | CentOS 6.2 | 6.2 | http://centos.org/centos/6.2 centos6.3 | CentOS 6.3 | 6.3 | http://centos.org/centos/6.3 centos6.4 | CentOS 6.4 | 6.4 | http://centos.org/centos/6.4 centos6.5 | CentOS 6.5 | 6.5 | http://centos.org/centos/6.5 centos6.6 | CentOS 6.6 | 6.6 | http://centos.org/centos/6.6 centos6.7 | CentOS 6.7 | 6.7 | http://centos.org/centos/6.7 centos6.8 | CentOS 6.8 | 6.8 | http://centos.org/centos/6.8 centos6.9 | CentOS 6.9 | 6.9 | http://centos.org/centos/6.9 centos7.0 | CentOS 7 | 7 | http://centos.org/centos/7.0 [root@pm01 images]#
Excute command(virt-install) to create CentOS 8 with cloud-init on KVM.
I use above all information.
and then I prepare script file to create VM.
[root@pm01 kvm_work]# vi create_vm05.sh
[root@pm01 kvm_work]#
[root@pm01 kvm_work]# cat create_vm05.sh
#!/bin/bash
name=vm05
cpu=1
memory=4096
# disk=30
# cd /var/lib/libvirt/images/
# cp -vp CentOS-8-GenericCloud-8.2.2004-20200611.2.x86_64.qcow2 ${name}.qcow2
# qemu-img resize ${name}.qcow2 ${disk}G
virt-install \
--name=${name} \
--disk /var/lib/libvirt/images/${name}.qcow2,device=disk \
--disk /var/lib/libvirt/images/config.iso,device=cdrom \
--network network=default,model=virtio \
--vcpus=${cpu} \
--ram=${memory} \
--accelerate \
--hvm \
--virt-type kvm \
--graphics none \
--os-type Linux \
--arch=x86_64 \
--import
[root@pm01 kvm_work]#
Finally, CentOS 8 VM was created by cloud-init with cloud config on KVM.
and I can log in to this VM.
[root@pm01 kvm_work]# bash create_vm05.sh *snip* CentOS Linux 8 (Core) Kernel 4.18.0-193.6.3.el8_2.x86_64 on an x86_64 Activate the web console with: systemctl enable --now cockpit.socket testnode login: centos Password: [centos@testnode ~]$ id uid=1000(centos) gid=1000(centos) groups=1000(centos),10(wheel) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 [centos@testnode ~]$