cookbook 'k8s', '~> 0.3.1'
The k8s cookbook has been deprecated
Author provided reason for deprecation:
The k8s cookbook has been deprecated and is no longer being maintained by its authors. Use of the k8s cookbook is no longer recommended.
You may find that the kubernetes cookbook is a suitable alternative.
k8s (2) Versions 0.3.1 Follow0
Manipulate Kubernetes resources
cookbook 'k8s', '~> 0.3.1', :supermarket
knife supermarket install k8s
knife supermarket download k8s
k8s
Resources for deploying various Kubernetes entities, these resources are designed to be ran on the kubernetes master but can be ran anywhere that has access to a kubernetes api by changing the ['k8s']['master']['ip']
attribute. These resources utilize the kubeclient ruby gem and run against the v1beta1 api.
Currently supported resources:
- Kubernetes Pod (
kube_pod
) - Kubernetes Replication Controller (
kube_replication_controller
) - Kubernetes Service (
kube_service
)
Currently supported platforms:
* Redhat Enterprise Linux 7.x
Attributes
-
['k8s']['master']['ip']
- the address used when contacting the kubernetes api -
['k8s']['master']['port']
- the port that will be used whe contacting the kubernetes api -
['k8s']['client_version']
- the version of the kubeclient gem to install
Recipes
default
Installs the kubeclient ruby gem for interacting with the Kubernetes api
install
Installs the needed packages for kubernetes
master
Ensures the needed services are started/enabled for a kubernetes master
node
Ensures the needed services are started/enabled for a kubernetes node/minion
Resources and Providers
Kubernetes Pod (kube_pod
)
Manage a standalone Kubernetes pod, there is no redundancy in a pod and is simply used to specify a group of containers to be jointly deployed on a host.
Actions
-
create
- default. ensures the pod is created -
destroy
- ensures the pod does not exist
Attribute Parameters
-
id
- name attribute. The identifier used when managing the pod -
containers
- required a hash of container information that will be used when creating the pod -
volumes
- a hash of volume information used when specifying storage for containers -
labels
- specify the labels that will be added to the pod
Examples
kube_pod "my-pod" do containers({ name: 'pod-member', image: 'my/image' }) labels "aww=yiss" action [:destroy,:create] end
Kubernetes Replication Controller (kube_replication_controller
)
Replication controllers are used to maintain a consistent amount of a pod at any given time using selector labels
Actions
-
create
- default. ensures the replication controller is created -
destroy
- ensures the replication controller does not exist
Attribute Parameters
-
id
- name attribute. The identifier used when managing the replication controller -
containers
- required a hash of container information that will be used when the replication controller needs to generate new pods -
volumes
- a hash of volume information used in generating new pods -
selector
- how the replication controller will ensure that enough replicas exist -
pod_labels
- specify the labels added to the indivial pods that are spawned off -
labels
- specify the labels that will be added to the replication controller
Examples
kube_replication_controller "master-controller" do containers({ name: 'redis-master', image: 'dockerfile/redis' }) replicas 2 selector 'role' => 'master','app' => 'redis' labels ['aww=yiss','motha-freakin=breadcrumbs'] action [:destroy,:create] end
Kubernetes Service (kube_service
)
Deploy a Kubernetes service, which can be used as a basic container load balancer that routes traffic based on selector labels
Actions
-
create
- default. ensure the service exists -
destroy
- ensure the service does not exist
Attribute Parameters
-
id
- name attribute. The identifier used when managing the service -
port
- required the port that the service will listen on for traffic -
container_port
- what port the service will route to on the selected containers defaults to the port that the service is listening on -
selector
- labels that the service will use when choosing containers to route traffic to -
labels
- labels that will be added to the service
Examples
kube_service "backend-service" do port 8005 selector 'role' => 'backend' end
Containers and Volumes
The syntax used when specifing containers and volumes is specific to the kubernetes api, for examples on what these can/should look like please see the kubernetes documentation/examples.
Labels
Theres a bit of magic in the helper library that allows you to specify labels as either a hash 'this' => 'that', 'app' => 'redis'
, an array of labels ['this=that','app=redis']
, or a comma delimited string 'this=that,app=redis'
. All three will be treated as the same thing when writing your resources.
License and Author
- Author:: Andre Elizondo (andre@chef.io)
Copyright 2015, Chef Software, Inc.
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
yum >= 0.0.0 |
build-essential >= 0.0.0 |
selinux >= 0.0.0 |
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
Collaborator Number Metric
0.3.1 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
0.3.1 passed this metric
Foodcritic Metric
0.3.1 failed this metric
FC064: Ensure issues_url is set in metadata: k8s/metadata.rb:1
FC065: Ensure source_url is set in metadata: k8s/metadata.rb:1
FC066: Ensure chef_version is set in metadata: k8s/metadata.rb:1
FC069: Ensure standardized license defined in metadata: k8s/metadata.rb:1
FC070: Ensure supports metadata defines valid platforms: k8s/metadata.rb:1
FC085: Resource using new_resource.updated_by_last_action to converge resource: k8s/providers/pod.rb:33
FC085: Resource using new_resource.updated_by_last_action to converge resource: k8s/providers/pod.rb:54
FC085: Resource using new_resource.updated_by_last_action to converge resource: k8s/providers/replication_controller.rb:31
FC085: Resource using new_resource.updated_by_last_action to converge resource: k8s/providers/replication_controller.rb:49
FC085: Resource using new_resource.updated_by_last_action to converge resource: k8s/providers/service.rb:32
FC085: Resource using new_resource.updated_by_last_action to converge resource: k8s/providers/service.rb:50
FC121: Cookbook depends on cookbook made obsolete by Chef 14: k8s/metadata.rb:1
FC122: Use the build_essential resource instead of the recipe: k8s/recipes/default.rb:18
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
0.3.1 passed this metric
Testing File Metric
0.3.1 passed this metric
Version Tag Metric
0.3.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 https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.3.1 failed this metric
0.3.1 passed this metric
Foodcritic Metric
0.3.1 failed this metric
FC064: Ensure issues_url is set in metadata: k8s/metadata.rb:1
FC065: Ensure source_url is set in metadata: k8s/metadata.rb:1
FC066: Ensure chef_version is set in metadata: k8s/metadata.rb:1
FC069: Ensure standardized license defined in metadata: k8s/metadata.rb:1
FC070: Ensure supports metadata defines valid platforms: k8s/metadata.rb:1
FC085: Resource using new_resource.updated_by_last_action to converge resource: k8s/providers/pod.rb:33
FC085: Resource using new_resource.updated_by_last_action to converge resource: k8s/providers/pod.rb:54
FC085: Resource using new_resource.updated_by_last_action to converge resource: k8s/providers/replication_controller.rb:31
FC085: Resource using new_resource.updated_by_last_action to converge resource: k8s/providers/replication_controller.rb:49
FC085: Resource using new_resource.updated_by_last_action to converge resource: k8s/providers/service.rb:32
FC085: Resource using new_resource.updated_by_last_action to converge resource: k8s/providers/service.rb:50
FC121: Cookbook depends on cookbook made obsolete by Chef 14: k8s/metadata.rb:1
FC122: Use the build_essential resource instead of the recipe: k8s/recipes/default.rb:18
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
0.3.1 passed this metric
Testing File Metric
0.3.1 passed this metric
Version Tag Metric
0.3.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 https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.3.1 failed this metric
FC065: Ensure source_url is set in metadata: k8s/metadata.rb:1
FC066: Ensure chef_version is set in metadata: k8s/metadata.rb:1
FC069: Ensure standardized license defined in metadata: k8s/metadata.rb:1
FC070: Ensure supports metadata defines valid platforms: k8s/metadata.rb:1
FC085: Resource using new_resource.updated_by_last_action to converge resource: k8s/providers/pod.rb:33
FC085: Resource using new_resource.updated_by_last_action to converge resource: k8s/providers/pod.rb:54
FC085: Resource using new_resource.updated_by_last_action to converge resource: k8s/providers/replication_controller.rb:31
FC085: Resource using new_resource.updated_by_last_action to converge resource: k8s/providers/replication_controller.rb:49
FC085: Resource using new_resource.updated_by_last_action to converge resource: k8s/providers/service.rb:32
FC085: Resource using new_resource.updated_by_last_action to converge resource: k8s/providers/service.rb:50
FC121: Cookbook depends on cookbook made obsolete by Chef 14: k8s/metadata.rb:1
FC122: Use the build_essential resource instead of the recipe: k8s/recipes/default.rb:18
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
0.3.1 passed this metric
Testing File Metric
0.3.1 passed this metric
Version Tag Metric
0.3.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 https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.3.1 passed this metric
0.3.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 https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number