cookbook 'kube', '= 2.0.1'
kube (14) Versions 2.0.1 Follow6
Custom resources to build a Kubernetes Cluster
cookbook 'kube', '= 2.0.1', :supermarket
knife supermarket install kube
knife supermarket download kube
kube cookbook
The kube cookbook is a Library cookbook that provides custom resources for
managing various components of a Kubernetes cluster.
Requirements
- Chef 12.5 or higher. Chef 11 and 12.0-12.4 is NOT SUPPORTED. Please do not open issues about it.
- Network accessible web server hosting the Kubernetes binaries.
Cookbook Dependencies
None
Usage
- Add
'kube', '~> 2.0'
to your cookbook'smetadata.rb
. - Use the resources shipped in this cookbook in your recipes the same way you use core Chef resources like file, template, directory, package, etc.
# Master
kube_apiserver 'default' do
service_cluster_ip_range '10.0.0.1/24'
etcd_servers 'http://127.0.0.1:4001'
insecure_bind_address '0.0.0.0' # for convenience
action %w(create start)
end
kube_scheduler 'default' do
action %w(create start)
end
kube_controller_manager 'default' do
action %w(create start)
end
# Node
kubelet_service 'default' do
api_servers 'http://127.0.0.1:8080'
config '/etc/kubernetes/manifests'
cluster_dns '10.0.0.10'
cluster_domain 'cluster.local'
action %w(create start)
end
kube_proxy 'default' do
action %w(create start)
end
The test cookbook ran under test-kitchen provide good usage examples. It is
found in test/cookbooks/kube_test
.
Resources Overview
Components for a Kubernetes node:
kubelet
kube_proxy
Components for a Kubernetes master:
kube_apiserver
kube_scheduler
kube_controller_manager
Common Properties
All the above resources will contain the following properties:
-
remote
- The URL of where a corresponding component's binary can be downloaded. The default value points to the official Kubernetes release URL of each component. Check each resource for the default value of each component. -
checksum
- The SHA256 hash of the Kubernetes component's binary. -
run_user
- The user in which to run the Kubernetes user. Defaults to'kubernetes'
.
Common Actions
All the above resources will contain the following actions:
-
create
- Download the Kubernetes component's binary to/usr/bin
. -
start
- Starts the Kubernetes component managed through a systemd unit.
Resource Properties
Each resource' set of unique properties corresponds to the options in the
Kubernetes component they represent:
-
kube_apiserver
- https://github.com/kubernetes/kubernetes.github.io/blob/release-1.4/docs/admin/kube-apiserver.md -
kube_controller_manager
- https://github.com/kubernetes/kubernetes.github.io/blob/release-1.4/docs/admin/kube-controller-manager.md -
kube_scheduler
- https://github.com/kubernetes/kubernetes.github.io/blob/release-1.4/docs/admin/kube-scheduler.md -
kubelet
- https://github.com/kubernetes/kubernetes.github.io/blob/release-1.4/docs/admin/kubelet.md -
kube_proxy
- https://github.com/kubernetes/kubernetes.github.io/blob/release-1.4/docs/admin/kube-proxy.md
In general, a command line flag of the form --long-option
will correspond to
a custom resource property called long_option
.
Extending Properties
When newer versions of Kubernetes are released, components might introduce and
deprecate some commandline flags that are not yet hard-coded as properties.
To add these properties, a wrapper cookbook can be written like the following:
# wrapper-cookbook/metadata.rb
name 'wrapper-cookbook'
depends 'kube', '~> 2.0' # Make sure you have this
# wrapper-cookbook/libraries/apiserver.rb
class KubernetesCookbook::KubeApiserver
property :something_only_in_kubernetes9000
end
The kube_apiserver
resource can now use the new commandline flag available
in Kubernetes v9000 like the following:
# wrapper-cookbook/recipes/default.rb
kube_apiserver 'default' do
something_only_in_kubernetes9000 'someflag'
end
License
Copyright 2016-2017 Allan Espinosa
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
Collaborator Number Metric
2.0.1 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
2.0.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of http://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
2.0.1 passed this metric
License Metric
2.0.1 failed this metric
kube does not have a valid open source license.
Acceptable licenses include Apache-2.0, apachev2, Apache 2.0, MIT, mit, GPL-2.0, gplv2, GNU Public License 2.0, GPL-3.0, gplv3, GNU Public License 3.0.
No Binaries Metric
2.0.1 passed this metric
Testing File Metric
2.0.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of http://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
2.0.1 passed this metric
2.0.1 failed this metric
2.0.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of http://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
2.0.1 passed this metric
License Metric
2.0.1 failed this metric
kube does not have a valid open source license.
Acceptable licenses include Apache-2.0, apachev2, Apache 2.0, MIT, mit, GPL-2.0, gplv2, GNU Public License 2.0, GPL-3.0, gplv3, GNU Public License 3.0.
No Binaries Metric
2.0.1 passed this metric
Testing File Metric
2.0.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of http://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
2.0.1 passed this metric
2.0.1 passed this metric
2.0.1 failed this metric
kube does not have a valid open source license.
Acceptable licenses include Apache-2.0, apachev2, Apache 2.0, MIT, mit, GPL-2.0, gplv2, GNU Public License 2.0, GPL-3.0, gplv3, GNU Public License 3.0.
No Binaries Metric
2.0.1 passed this metric
Testing File Metric
2.0.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of http://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
2.0.1 passed this metric
2.0.1 passed this metric
2.0.1 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of http://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
2.0.1 passed this metric
2.0.1 passed this metric