创建部署问题时,请参考下面模板,你提供的信息越多,越容易及时获得解答。
你只花一分钟创建的问题,不能指望别人花上半个小时给你解答。
发帖前请点击 发表主题 右边的 预览(👀) 按钮,确保帖子格式正确。
操作系统信息
例如:虚拟机,Centos7.9,MASTER 2C/8G NODE 2C/32G
Kubernetes版本信息
v1.20.9
多节点3master,2node
KubeSphere版本信息
v3.1.1。已有K8s安装。
问题是什么
kubectl apply cluster-configuration.yaml时报错,Ansible执行剧本 “msg”: “AnsibleUndefinedVariable: ‘list object’ has no attribute ‘split’”,但是不知道怎么修复。
ask ‘monitoring’ failed:
{
“counter”: 69,
“created”: “2024-05-09T09:51:43.947005”,
“end_line”: 68,
“event”: “runner_on_failed”,
“event_data”: {
“duration”: 22.859497,
“end”: “2024-05-09T09:51:43.946857”,
“event_loop”: “items”,
“host”: “localhost”,
“ignore_errors”: null,
“play”: “localhost”,
“play_pattern”: “localhost”,
“play_uuid”: “22e22916-e127-f95f-d312-000000000005”,
“playbook”: “/kubesphere/playbooks/monitoring.yaml”,
“playbook_uuid”: “cabedfd4-8bdf-4c5e-b9f8-c894673b9878”,
“remote_addr”: “127.0.0.1”,
“res”: {
“changed”: true,
“msg”: “All items completed”,
“results”: [
{
“ansible_item_label”: {
“file”: “prometheus-operator-deployment.yaml”,
“path”: “prometheus/init”
},
“ansible_no_log”: false,
“ansible_loop_var”: “item”,
“changed”: true,
“checksum”: “7b672f1920eec139fe978a61548079a48695a41b”,
“dest”: “/kubesphere/kubesphere/prometheus/init/prometheus-operator-deployment.yaml”,
“diff”: [],
“failed”: false,
“gid”: 1002,
“group”: “kubesphere”,
“invocation”: {
“module_args”: {
“original_basename”: “prometheus-operator-deployment.yaml.j2”,
“attributes”: null,
“backup”: false,
“checksum”: “7b672f1920eec139fe978a61548079a48695a41b”,
“content”: null,
“delimiter”: null,
“dest”: “/kubesphere/kubesphere/prometheus/init/prometheus-operator-deployment.yaml”,
“directory_mode”: null,
“follow”: false,
“force”: true,
“group”: null,
“local_follow”: null,
“mode”: null,
“owner”: null,
“regexp”: null,
“remote_src”: null,
“selevel”: null,
“serole”: null,
“setype”: null,
“seuser”: null,
“src”: “/home/kubesphere/.ansible/tmp/ansible-tmp-1715248281.3612747-8876-143590179226107/source”,
“unsafe_writes”: null,
“validate”: null
}
},
“item”: {
“file”: “prometheus-operator-deployment.yaml”,
“path”: “prometheus/init”
},
“md5sum”: “c0ef79d8a84dd210b96c391703342bcf”,
“mode”: “0644”,
“owner”: “kubesphere”,
“size”: 2188,
“src”: “/home/kubesphere/.ansible/tmp/ansible-tmp-1715248281.3612747-8876-143590179226107/source”,
“state”: “file”,
“uid”: 1002
},
{
“ansible_item_label”: {
“file”: “prometheus-prometheus.yaml”,
“path”: “prometheus/prometheus”
},
“ansible_no_log”: false,
“ansible_loop_var”: “item”,
“changed”: true,
“checksum”: “deb07e0cce19404784229c14ec8701f7130ab15e”,
“dest”: “/kubesphere/kubesphere/prometheus/prometheus/prometheus-prometheus.yaml”,
“diff”: [],
“failed”: false,
“gid”: 1002,
“group”: “kubesphere”,
“invocation”: {
“module_args”: {
“original_basename”: “prometheus-prometheus.yaml.j2”,
“attributes”: null,
“backup”: false,
“checksum”: “deb07e0cce19404784229c14ec8701f7130ab15e”,
“content”: null,
“delimiter”: null,
“dest”: “/kubesphere/kubesphere/prometheus/prometheus/prometheus-prometheus.yaml”,
“directory_mode”: null,
“follow”: false,
“force”: true,
“group”: null,
“local_follow”: null,
“mode”: null,
“owner”: null,
“regexp”: null,
“remote_src”: null,
“selevel”: null,
“serole”: null,
“setype”: null,
“seuser”: null,
“src”: “/home/kubesphere/.ansible/tmp/ansible-tmp-1715248286.639653-8876-20766119369815/source”,
“unsafe_writes”: null,
“validate”: null
}
},
“item”: {
“file”: “prometheus-prometheus.yaml”,
“path”: “prometheus/prometheus”
},
“md5sum”: “35ff60910352a1dc25b3642fc0b30973”,
“mode”: “0644”,
“owner”: “kubesphere”,
“size”: 1875,
“src”: “/home/kubesphere/.ansible/tmp/ansible-tmp-1715248286.639653-8876-20766119369815/source”,
“state”: “file”,
“uid”: 1002
},
{
“ansible_item_label”: {
“file”: “kube-state-metrics-deployment.yaml”,
“path”: “prometheus/kube-state-metrics”
},
“ansible_no_log”: false,
“ansible_loop_var”: “item”,
“changed”: true,
“checksum”: “b5d2ca99a9f9110771f0cdc32200dcf8ca7cd6f4”,
“dest”: “/kubesphere/kubesphere/prometheus/kube-state-metrics/kube-state-metrics-deployment.yaml”,
“diff”: [],
“failed”: false,
“gid”: 1002,
“group”: “kubesphere”,
“invocation”: {
“module_args”: {
“original_basename”: “kube-state-metrics-deployment.yaml.j2”,
“attributes”: null,
“backup”: false,
“checksum”: “b5d2ca99a9f9110771f0cdc32200dcf8ca7cd6f4”,
“content”: null,
“delimiter”: null,
“dest”: “/kubesphere/kubesphere/prometheus/kube-state-metrics/kube-state-metrics-deployment.yaml”,
“directory_mode”: null,
“follow”: false,
“force”: true,
“group”: null,
“local_follow”: null,
“mode”: null,
“owner”: null,
“regexp”: null,
“remote_src”: null,
“selevel”: null,
“serole”: null,
“setype”: null,
“seuser”: null,
“src”: “/home/kubesphere/.ansible/tmp/ansible-tmp-1715248288.7753625-8876-224592941200019/source”,
“unsafe_writes”: null,
“validate”: null
}
},
“item”: {
“file”: “kube-state-metrics-deployment.yaml”,
“path”: “prometheus/kube-state-metrics”
},
“md5sum”: “4d0ca23a04e9ae6fffec69376d15dae8”,
“mode”: “0644”,
“owner”: “kubesphere”,
“size”: 3198,
“src”: “/home/kubesphere/.ansible/tmp/ansible-tmp-1715248288.7753625-8876-224592941200019/source”,
“state”: “file”,
“uid”: 1002
},
{
“ansible_item_label”: {
“file”: “node-exporter-daemonset.yaml”,
“path”: “prometheus/node-exporter”
},
“ansible_no_log”: false,
“ansible_loop_var”: “item”,
“changed”: true,
“checksum”: “b64709d51c5df7df789c1175d97cdbb59dd38c75”,
“dest”: “/kubesphere/kubesphere/prometheus/node-exporter/node-exporter-daemonset.yaml”,
“diff”: [],
“failed”: false,
“gid”: 1002,
“group”: “kubesphere”,
“invocation”: {
“module_args”: {
“original_basename”: “node-exporter-daemonset.yaml.j2”,
“attributes”: null,
“backup”: false,
“checksum”: “b64709d51c5df7df789c1175d97cdbb59dd38c75”,
“content”: null,
“delimiter”: null,
“dest”: “/kubesphere/kubesphere/prometheus/node-exporter/node-exporter-daemonset.yaml”,
“directory_mode”: null,
“follow”: false,
“force”: true,
“group”: null,
“local_follow”: null,
“mode”: null,
“owner”: null,
“regexp”: null,
“remote_src”: null,
“selevel”: null,
“serole”: null,
“setype”: null,
“seuser”: null,
“src”: “/home/kubesphere/.ansible/tmp/ansible-tmp-1715248291.2110014-8876-78233260029090/source”,
“unsafe_writes”: null,
“validate”: null
}
},
“item”: {
“file”: “node-exporter-daemonset.yaml”,
“path”: “prometheus/node-exporter”
},
“md5sum”: “2d3390ca3751243647bbaeb911012633”,
“mode”: “0644”,
“owner”: “kubesphere”,
“size”: 3053,
“src”: “/home/kubesphere/.ansible/tmp/ansible-tmp-1715248291.2110014-8876-78233260029090/source”,
“state”: “file”,
“uid”: 1002
},
{
“ansible_item_label”: {
“file”: “alertmanager-alertmanager.yaml”,
“path”: “prometheus/alertmanager”
},
“ansible_no_log”: false,
“ansible_loop_var”: “item”,
“changed”: true,
“checksum”: “7df0d28f71d6b4936d6c7ac30d079ab94ee219ed”,
“dest”: “/kubesphere/kubesphere/prometheus/alertmanager/alertmanager-alertmanager.yaml”,
“diff”: [],
“failed”: false,
“gid”: 1002,
“group”: “kubesphere”,
“invocation”: {
“module_args”: {
“original_basename”: “alertmanager-alertmanager.yaml.j2”,
“attributes”: null,
“backup”: false,
“checksum”: “7df0d28f71d6b4936d6c7ac30d079ab94ee219ed”,
“content”: null,
“delimiter”: null,
“dest”: “/kubesphere/kubesphere/prometheus/alertmanager/alertmanager-alertmanager.yaml”,
“directory_mode”: null,
“follow”: false,
“force”: true,
“group”: null,
“local_follow”: null,
“mode”: null,
“owner”: null,
“regexp”: null,
“remote_src”: null,
“selevel”: null,
“serole”: null,
“setype”: null,
“seuser”: null,
“src”: “/home/kubesphere/.ansible/tmp/ansible-tmp-1715248294.451513-8876-166686210044851/source”,
“unsafe_writes”: null,
“validate”: null
}
},
“item”: {
“file”: “alertmanager-alertmanager.yaml”,
“path”: “prometheus/alertmanager”
},
“md5sum”: “5f2054bd050de2933924fd51c9d8bc81”,
“mode”: “0644”,
“owner”: “kubesphere”,
“size”: 901,
“src”: “/home/kubesphere/.ansible/tmp/ansible-tmp-1715248294.451513-8876-166686210044851/source”,
“state”: “file”,
“uid”: 1002
},
{
“ansible_item_label”: {
“file”: “prometheus-adapter-deployment.yaml”,
“path”: “prometheus/prometheus-adapter”
},
“ansible_no_log”: false,
“ansible_loop_var”: “item”,
“changed”: true,
“checksum”: “64b5e09c5618614bc71b85940e90a239f763cbb4”,
“dest”: “/kubesphere/kubesphere/prometheus/prometheus-adapter/prometheus-adapter-deployment.yaml”,
“diff”: [],
“failed”: false,
“gid”: 1002,
“group”: “kubesphere”,
“invocation”: {
“module_args”: {
“original_basename”: “prometheus-adapter-deployment.yaml.j2”,
“attributes”: null,
“backup”: false,
“checksum”: “64b5e09c5618614bc71b85940e90a239f763cbb4”,
“content”: null,
“delimiter”: null,
“dest”: “/kubesphere/kubesphere/prometheus/prometheus-adapter/prometheus-adapter-deployment.yaml”,
“directory_mode”: null,
“follow”: false,
“force”: true,
“group”: null,
“local_follow”: null,
“mode”: null,
“owner”: null,
“regexp”: null,
“remote_src”: null,
“selevel”: null,
“serole”: null,
“setype”: null,
“seuser”: null,
“src”: “/home/kubesphere/.ansible/tmp/ansible-tmp-1715248296.7542493-8876-240351784207548/source”,
“unsafe_writes”: null,
“validate”: null
}
},
“item”: {
“file”: “prometheus-adapter-deployment.yaml”,
“path”: “prometheus/prometheus-adapter”
},
“md5sum”: “ce13fa3af41bf2630f8aa1853d955c4e”,
“mode”: “0644”,
“owner”: “kubesphere”,
“size”: 1512,
“src”: “/home/kubesphere/.ansible/tmp/ansible-tmp-1715248296.7542493-8876-240351784207548/source”,
“state”: “file”,
“uid”: 1002
},
{
“ansible_item_label”: {
“file”: “grafana-deployment.yaml”,
“path”: “prometheus/grafana”
},
“ansible_no_log”: false,
“ansible_loop_var”: “item”,
“changed”: true,
“checksum”: “4613daed59b2809eca77856d4b0c9dec2c609c65”,
“dest”: “/kubesphere/kubesphere/prometheus/grafana/grafana-deployment.yaml”,
“diff”: [],
“failed”: false,
“gid”: 1002,
“group”: “kubesphere”,
“invocation”: {
“module_args”: {
“original_basename”: “grafana-deployment.yaml.j2”,
“attributes”: null,
“backup”: false,
“checksum”: “4613daed59b2809eca77856d4b0c9dec2c609c65”,
“content”: null,
“delimiter”: null,
“dest”: “/kubesphere/kubesphere/prometheus/grafana/grafana-deployment.yaml”,
“directory_mode”: null,
“follow”: false,
“force”: true,
“group”: null,
“local_follow”: null,
“mode”: null,
“owner”: null,
“regexp”: null,
“remote_src”: null,
“selevel”: null,
“serole”: null,
“setype”: null,
“seuser”: null,
“src”: “/home/kubesphere/.ansible/tmp/ansible-tmp-1715248298.3641346-8876-171165033613963/source”,
“unsafe_writes”: null,
“validate”: null
}
},
“item”: {
“file”: “grafana-deployment.yaml”,
“path”: “prometheus/grafana”
},
“md5sum”: “22e4f9f0afe4eab0230f4aee83f01276”,
“mode”: “0644”,
“owner”: “kubesphere”,
“size”: 7817,
“src”: “/home/kubesphere/.ansible/tmp/ansible-tmp-1715248298.3641346-8876-171165033613963/source”,
“state”: “file”,
“uid”: 1002
},
{
“ansible_item_label”: {
“file”: “prometheus-serviceMonitorEtcd.yaml”,
“path”: “prometheus/etcd”
},
“ansible_no_log”: false,
“ansible_loop_var”: “item”,
“changed”: true,
“checksum”: “a9e574949e07a9fcf69e3b7d4e07a0388e3b1183”,
“dest”: “/kubesphere/kubesphere/prometheus/etcd/prometheus-serviceMonitorEtcd.yaml”,
“diff”: [],
“failed”: false,
“gid”: 1002,
“group”: “kubesphere”,
“invocation”: {
“module_args”: {
“original_basename”: “prometheus-serviceMonitorEtcd.yaml.j2”,
“attributes”: null,
“backup”: false,
“checksum”: “a9e574949e07a9fcf69e3b7d4e07a0388e3b1183”,
“content”: null,
“delimiter”: null,
“dest”: “/kubesphere/kubesphere/prometheus/etcd/prometheus-serviceMonitorEtcd.yaml”,
“directory_mode”: null,
“follow”: false,
“force”: true,
“group”: null,
“local_follow”: null,
“mode”: null,
“owner”: null,
“regexp”: null,
“remote_src”: null,
“selevel”: null,
“serole”: null,
“setype”: null,
“seuser”: null,
“src”: “/home/kubesphere/.ansible/tmp/ansible-tmp-1715248299.8220437-8876-120502290600821/source”,
“unsafe_writes”: null,
“validate”: null
}
},
“item”: {
“file”: “prometheus-serviceMonitorEtcd.yaml”,
“path”: “prometheus/etcd”
},
“md5sum”: “81a41c1b283fbf1bc60659976dbd2a30”,
“mode”: “0644”,
“owner”: “kubesphere”,
“size”: 640,
“src”: “/home/kubesphere/.ansible/tmp/ansible-tmp-1715248299.8220437-8876-120502290600821/source”,
“state”: “file”,
“uid”: 1002
},
{
“ansible_item_label”: {
“file”: “prometheus-endpointsEtcd.yaml”,
“path”: “prometheus/etcd”
},
“ansible_no_log”: false,
“ansible_loop_var”: “item”,
“changed”: false,
“failed”: true,
“item”: {
“file”: “prometheus-endpointsEtcd.yaml”,
“path”: “prometheus/etcd”
},
“msg”: “AnsibleUndefinedVariable: ‘list object’ has no attribute ‘split’”
},
{
“ansible_item_label”: {
“file”: “thanosruler.yaml”,
“path”: “prometheus/thanosruler”
},
“ansible_no_log”: false,
“ansible_loop_var”: “item”,
“changed”: true,
“checksum”: “11349b42b750da7328ab93d9cd751a2cf223b38d”,
“dest”: “/kubesphere/kubesphere/prometheus/thanosruler/thanosruler.yaml”,
“diff”: [],
“failed”: false,
“gid”: 1002,
“group”: “kubesphere”,
“invocation”: {
“module_args”: {
“_original_basename”: “thanosruler.yaml.j2”,
“attributes”: null,
“backup”: false,
“checksum”: “11349b42b750da7328ab93d9cd751a2cf223b38d”,
“content”: null,
“delimiter”: null,
“dest”: “/kubesphere/kubesphere/prometheus/thanosruler/thanosruler.yaml”,
“directory_mode”: null,
“follow”: false,
“force”: true,
“group”: null,
“local_follow”: null,
“mode”: null,
“owner”: null,
“regexp”: null,
“remote_src”: null,
“selevel”: null,
“serole”: null,
“setype”: null,
“seuser”: null,
“src”: “/home/kubesphere/.ansible/tmp/ansible-tmp-1715248302.6191254-8876-138874099913185/source”,
“unsafe_writes”: null,
“validate”: null
}
},
“item”: {
“file”: “thanosruler.yaml”,
“path”: “prometheus/thanosruler”
},
“md5sum”: “b6d3e6811d69fa7f298436b500204ed1”,
“mode”: “0644”,
“owner”: “kubesphere”,
“size”: 1042,
“src”: “/home/kubesphere/.ansible/tmp/ansible-tmp-1715248302.6191254-8876-138874099913185/source”,
“state”: “file”,
“uid”: 1002
}
]
},
“role”: “ks-monitor”,
“start”: “2024-05-09T09:51:21.087360”,
“task”: “Monitoring | Creating manifests”,
“task_action”: “template”,
“task_args”: "",
“task_path”: “/kubesphere/installer/roles/ks-monitor/tasks/generate_manifests.yaml:12”,
“task_uuid”: “22e22916-e127-f95f-d312-00000000002e”,
“uuid”: “a0db6281-5464-4df9-a17a-a04771772f09”
},
“parent_uuid”: “22e22916-e127-f95f-d312-00000000002e”,
“pid”: 5283,
“runner_ident”: “monitoring”,
“start_line”: 68,
“stdout”: "",
“uuid”: “a0db6281-5464-4df9-a17a-a04771772f09”
}
vim cluster-configuration.yaml
apiVersion: installer.kubesphere.io/v1alpha1
kind: ClusterConfiguration
metadata:
name: ks-installer
namespace: kubesphere-system
labels:
version: v3.1.1
spec:
persistence:
storageClass: "" # If there is no default StorageClass in your cluster, you need to specify an existing StorageClass here.
authentication:
jwtSecret: "" # Keep the jwtSecret consistent with the Host Cluster. Retrieve the jwtSecret by executing "kubectl -n kubesphere-system get cm kubesphere-config -o yaml | grep -v “apiVersion” | grep jwtSecret" on the Host
Cluster.
local_registry: "" # Add your private registry address if it is needed.
etcd:
monitoring: true # Enable or disable etcd monitoring dashboard installation. You have to create a Secret for etcd before you enable it.
endpointIps: # etcd cluster EndpointIps. It can be a bunch of IPs here.
- 192.168.1.242
- 192.168.1.243
- 192.168.1.244
port: 2379 # etcd port.
tlsEnable: true
common:
redis:
enabled: true
openldap:
enabled: true
minioVolumeSize: 20Gi # Minio PVC size.
openldapVolumeSize: 2Gi # openldap PVC size.
redisVolumSize: 2Gi # Redis PVC size.
monitoring:
type: external # Whether to specify the external prometheus stack, and need to modify the endpoint at the next line.
endpoint: http://prometheus-operated.kubesphere-monitoring-system.svc:9090 # Prometheus endpoint to get metrics data.
es: # Storage backend for logging, events and auditing.
elasticsearchMasterReplicas: 1 # The total number of master nodes. Even numbers are not allowed.
elasticsearchDataReplicas: 1 # The total number of data nodes.
elasticsearchMasterVolumeSize: 4Gi # The volume size of Elasticsearch master nodes.
elasticsearchDataVolumeSize: 20Gi # The volume size of Elasticsearch data nodes.
logMaxAge: 7 # Log retention time in built-in Elasticsearch. It is 7 days by default.
elkPrefix: logstash # The string making up index names. The index name will be formatted as ks-<elk_prefix>-log.
basicAuth:
enabled: false
username: ""
password: ""
externalElasticsearchUrl: ""
externalElasticsearchPort: ""
console:
enableMultiLogin: true # Enable or disable simultaneous logins. It allows different users to log in with the same account at the same time.
port: 30880
alerting: # (CPU: 0.1 Core, Memory: 100 MiB) It enables users to customize alerting policies to send messages to receivers in time with different time intervals and alerting levels to choose from.
enabled: true # Enable or disable the KubeSphere Alerting System.
thanosruler:
replicas: 1
resources: {}
auditing: # Provide a security-relevant chronological set of records,recording the sequence of activities happening on the platform, initiated by different tenants.
enabled: true # Enable or disable the KubeSphere Auditing Log System.
devops: # (CPU: 0.47 Core, Memory: 8.6 G) Provide an out-of-the-box CI/CD system based on Jenkins, and automated workflow tools including Source-to-Image & Binary-to-Image.
enabled: true # Enable or disable the KubeSphere DevOps System.
jenkinsMemoryLim: 2Gi # Jenkins memory limit.
jenkinsMemoryReq: 1500Mi # Jenkins memory request.
jenkinsVolumeSize: 8Gi # Jenkins volume size.
jenkinsJavaOpts_Xms: 512m # The following three fields are JVM parameters.
jenkinsJavaOpts_Xmx: 512m
jenkinsJavaOpts_MaxRAM: 2g