我目前正在尝试使用Kops工具箱cli构建一个Kops模板。不幸的是,当我运行该命令时,我得到了以下错误:
unable decode the configuration file: /dev/fd/63, error: error converting YAML to JSON: yaml: control characters are not allowed我对Kops和模板一般都是新手,所以我想知道以前是否有人遇到过这个问题?下面是我的cluster-template.yaml:
apiVersion: kops.k8s.io/v1alpha2
kind: Cluster
metadata:
name: {{ .clusterName.value }}
spec:
additionalPolicies:
node: |
[
{
"Effect": "Allow",
"Action": [
"sts:AssumeRole"
],
"Resource": [
"arn:aws:iam:::role/k8s-*"
]
}
]
api:
loadBalancer:
crossZoneLoadBalancing: true
type: Internal
class: Network
authentication:
aws: {}
authorization:
rbac: {}
channel: stable
cloudProvider: aws
clusterAutoscaler:
enabled: true
cpuRequest: "100m"
memoryRequest: "300Mi"
configBase: {{ .state.value }}/{{ .clusterName.value }}
containerRuntime: docker
dnsZone: {{ .dnsZone.value }}.k8s
etcdClusters:
- cpuRequest: 200m
etcdMembers:
{{ range $i, $az := .availability_zones.value }}
- instanceGroup: master-{{ . }}
name: {{ . | replace $.region.value "" }} {{ /* converts us-east-1a to a */ }}
{{ end }}
memoryRequest: 100Mi
name: main
- cpuRequest: 100m
etcdMembers:
{{ range $i, $az := .availability_zones.value }}
- instanceGroup: master-{{ . }}
name: {{ . | replace $.region.value "" }} {{ /* converts us-east-1a to a */ }}
{{ end }}
memoryRequest: 100Mi
name: events
iam:
allowContainerRegistry: true
legacy: false
kubeDNS:
provider: CoreDNS
nodeLocalDNS:
enabled: true
memoryRequest: 5Mi
cpuRequest: 25m
kubelet:
anonymousAuth: false
authenticationTokenWebhook: true
authorizationMode: Webhook
kubernetesApiAccess:
- 192.168.0.0/24
- 192.168.4.0/24
- 192.168.5.0/24
- 192.168.10.0/24
kubernetesVersion: 1.19.7
kubeProxy:
proxyMode: ipvs
ipvsScheduler: lc
masterInternalName: internal.{{ .clusterName.value }}
masterPublicName: {{ .clusterName.value }}
networkCIDR: {{ .vpc_cidr.value }}
networkID: {{ .vpc_id.value }}
networking:
weave:
mtu: 8912
nonMasqueradeCIDR: 100.64.0.0/10
sshAccess:
- 192.168.0.0/24
- 192.168.4.0/24
- 192.168.5.0/24
- 192.168.10.0/24
subnets:
# Private Subnets, one per AZ
{{ range $i, $id := .private_subnet_ids.value }}
- cidr: {{ index $.private_subnet_ids.value $i }}
egress: {{ index $.nat_gateway_ids.value $i }}
id: {{ . }}
name: {{ index $.availability_zones.value $i }}
type: Private
zone: {{ index $.availability_zones.value $i }}
{{ end }}
topology:
dns:
type: Private
masters: private
nodes: private
---
# Creating one master per AZ
{{ range $.availability_zones.value }}
apiVersion: kops.k8s.io/v1alpha2
kind: InstanceGroup
metadata:
labels:
kops.k8s.io/cluster: {{ .clusterName.value }}
name: master-{{ . }}
spec:
image: 099720109477/ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-20210119.1
machineType: m5.large
maxSize: 1
minSize: 1
nodeLabels:
kops.k8s.io/instancegroup: master-{{ . }}
role: Master
subnets:
- {{ . }}
---
{{ end }}
{{ range .availability_zones }}
apiVersion: kops.k8s.io/v1alpha2
kind: InstanceGroup
metadata:
labels:
kops.k8s.io/cluster: {{ .clusterName }}
name: nodes-{{ . }}
spec:
image: 099720109477/ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-20210119.1
machineType: m5.xlarge
maxSize: 5
minSize: 3
nodeLabels:
kops.k8s.io/instancegroup: nodes-{{ . }}
role: Node
subnets:
- {{ . }}
---
{{ end }}我的最终目标是将这个模板与一些输入结合起来,根据我们的环境动态构建模板。
发布于 2021-04-15 01:09:39
这与我的值文件相关,而不是我的集群模板。
https://stackoverflow.com/questions/67084315
复制相似问题