未定义的方法 `kube_apiserver' 主厨 kubernetes
undefined method `kube_apiserver' chef kubernetes
我正在使用最新的 Kube 说明书在我的环境中使用 Chef 部署 Kubernetes 集群这是我基于 chef supermarket
中提供的 Kube 说明书的食谱
# Etcd
etcd_service 'default' do
action %w(create start)
end
# Kubernetes cluster
kube_apiserver 'default' do
service_cluster_ip_range '10.0.0.1/24'
etcd_servers 'http://127.0.0.1:2379'
insecure_bind_address '0.0.0.0'
action %w(create start)
end
group 'docker' do
members %w(kubernetes)
end
kube_scheduler 'default' do
master '127.0.0.1:8080'
action %w(create start)
end
kube_controller_manager 'default' do
master '127.0.0.1:8080'
action %w(create start)
end
这是我的 metadata.rb
depends 'etcd', '>= 6.0.0'
depends 'kube', '>= 4.0.0'
depends 'docker', '>= 7.0.0'
但是在 运行 食谱之后我得到以下错误:
================================================================================
virtualbox-iso: Recipe Compile Error in /var/chef/cache/cookbooks/k8_master/recipes/default.rb
virtualbox-iso: ================================================================================
virtualbox-iso:
virtualbox-iso: NoMethodError
virtualbox-iso: -------------
virtualbox-iso: undefined method `kube_apiserver' for cookbook: k8_master, recipe: default :Chef::Recipe
virtualbox-iso:
virtualbox-iso: Cookbook Trace: (most recent call first)
virtualbox-iso: ----------------------------------------
virtualbox-iso: /var/chef/cache/cookbooks/k8_master/recipes/default.rb:48:in `from_file'
virtualbox-iso:
virtualbox-iso: Relevant File Content:
virtualbox-iso: ----------------------
virtualbox-iso: /var/chef/cache/cookbooks/k8_master/recipes/default.rb:
virtualbox-iso:
virtualbox-iso: 46: # Kubernetes cluster
virtualbox-iso: 47:
virtualbox-iso: 48>> kube_apiserver 'default' do
virtualbox-iso: 49: service_cluster_ip_range '10.0.0.1/24'
virtualbox-iso: 50: etcd_servers 'http://127.0.0.1:2379'
virtualbox-iso: 51: insecure_bind_address '0.0.0.0'
virtualbox-iso: 52: action %w(create start)
virtualbox-iso: 53: end
virtualbox-iso:
virtualbox-iso: System Info:
virtualbox-iso: ------------
virtualbox-iso: chef_version=16.4.41
virtualbox-iso: platform=centos
virtualbox-iso: platform_version=7.8.2003
virtualbox-iso: ruby=ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
virtualbox-iso: program_name=/bin/chef-client
virtualbox-iso: executable=/opt/chef/bin/chef-client
virtualbox-iso:
virtualbox-iso:
我完全按照 Readme 中的说明进行操作
有人可以告诉我这里有什么问题吗?
您需要使用支持 Chef Infra Client 16 的 v5.0.0 版本:
https://github.com/aespinosa/cookbook-kube/commit/f95626f6ce00b9f8c9cf94fbcb87dfffb74d00c2
我正在使用最新的 Kube 说明书在我的环境中使用 Chef 部署 Kubernetes 集群这是我基于 chef supermarket
中提供的 Kube 说明书的食谱# Etcd
etcd_service 'default' do
action %w(create start)
end
# Kubernetes cluster
kube_apiserver 'default' do
service_cluster_ip_range '10.0.0.1/24'
etcd_servers 'http://127.0.0.1:2379'
insecure_bind_address '0.0.0.0'
action %w(create start)
end
group 'docker' do
members %w(kubernetes)
end
kube_scheduler 'default' do
master '127.0.0.1:8080'
action %w(create start)
end
kube_controller_manager 'default' do
master '127.0.0.1:8080'
action %w(create start)
end
这是我的 metadata.rb
depends 'etcd', '>= 6.0.0'
depends 'kube', '>= 4.0.0'
depends 'docker', '>= 7.0.0'
但是在 运行 食谱之后我得到以下错误:
================================================================================
virtualbox-iso: Recipe Compile Error in /var/chef/cache/cookbooks/k8_master/recipes/default.rb
virtualbox-iso: ================================================================================
virtualbox-iso:
virtualbox-iso: NoMethodError
virtualbox-iso: -------------
virtualbox-iso: undefined method `kube_apiserver' for cookbook: k8_master, recipe: default :Chef::Recipe
virtualbox-iso:
virtualbox-iso: Cookbook Trace: (most recent call first)
virtualbox-iso: ----------------------------------------
virtualbox-iso: /var/chef/cache/cookbooks/k8_master/recipes/default.rb:48:in `from_file'
virtualbox-iso:
virtualbox-iso: Relevant File Content:
virtualbox-iso: ----------------------
virtualbox-iso: /var/chef/cache/cookbooks/k8_master/recipes/default.rb:
virtualbox-iso:
virtualbox-iso: 46: # Kubernetes cluster
virtualbox-iso: 47:
virtualbox-iso: 48>> kube_apiserver 'default' do
virtualbox-iso: 49: service_cluster_ip_range '10.0.0.1/24'
virtualbox-iso: 50: etcd_servers 'http://127.0.0.1:2379'
virtualbox-iso: 51: insecure_bind_address '0.0.0.0'
virtualbox-iso: 52: action %w(create start)
virtualbox-iso: 53: end
virtualbox-iso:
virtualbox-iso: System Info:
virtualbox-iso: ------------
virtualbox-iso: chef_version=16.4.41
virtualbox-iso: platform=centos
virtualbox-iso: platform_version=7.8.2003
virtualbox-iso: ruby=ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
virtualbox-iso: program_name=/bin/chef-client
virtualbox-iso: executable=/opt/chef/bin/chef-client
virtualbox-iso:
virtualbox-iso:
我完全按照 Readme 中的说明进行操作 有人可以告诉我这里有什么问题吗?
您需要使用支持 Chef Infra Client 16 的 v5.0.0 版本:
https://github.com/aespinosa/cookbook-kube/commit/f95626f6ce00b9f8c9cf94fbcb87dfffb74d00c2