Cluster API로 Kubernetes Cluster 생성하기
Cluster
References
Cluster를 삭제하면 관련된 모든 리소스가 삭제됩니다.
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
spec:
clusterNetwork:
pods:
cidrBlocks:
- 10.243.0.0/16
services:
cidrBlocks:
- 10.95.0.0/16
controlPlaneRef:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: XXXControlPlane
name: <name>
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: XXXCluster
name: <name>
clusterNetworkpodscidrBlocks: []
servicescidrBlocks: []
controlPlaneRefapiVersion: controlplane.cluster.x-k8s.io/v1beta1kind: XXXControlPlanename: <name>namespace: <namespace>
infrastructureRefapiVersion: infrastructure.cluster.x-k8s.io/v1beta1kind: XXXClustername: <name>namespace: <namespace>
clusterctl describe cluster <clusterName>
clusterctl get kubeconfig <clusterName> > <clusterName>-config.yaml
Worker
References
Machine을 삭제하면XXXMachine,XXXBootstrapConfig이 삭제됩니다.
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
spec:
clusterName: <clusterName>
replicas: <replicas>
selector:
matchLabels:
cluster.x-k8s.io/cluster-name: <clusterName>
template:
metadata:
labels:
cluster.x-k8s.io/cluster-name: <clusterName>
spec:
clusterName: <clusterName>
bootstrap:
configRef:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: XXXBootstrapConfigTemplate
name: <name>
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: XXXMachineTemplate
name: <name>
templatespecbootstrapconfigRefapiVersion: bootstrap.cluster.x-k8s.io/v1beta1kind: XXXConfigTemplatename: <name>namespace: <namespace>
infrastructureRefapiVersion: infrastructure.cluster.x-k8s.io/v1beta1kind: XXXMachineTemplatename: <name>namespace: <namespace>
clusterctl describe cluster <clusterName>