#
# Cookbook Name:: kubernetes
# Attributes:: default
#
# Copyright 2016, whitestar
#
# 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.
#
default['kubernetes']['version'] = '1.7.8'
default['kubernetes']['fullversion'] = '1.7.8-1'
default['kubernetes']['domainname'] = 'xx.xx.xx.xx'
default['kubernetes']['yum_repo'] = {
'baseurl' => 'https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64',
'gpgcheck' => '1',
'repo_gpgcheck' => '1',
'gpgkey' => 'https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg',
}
===========================================================
metadata.rb
name 'kubernetes'
maintainer 'The Authors'
maintainer_email 'you@example.com'
license 'All Rights Reserved'
description 'Installs/Configures kubernetes'
long_description 'Installs/Configures kubernetes'
version '0.2.0'
chef_version '>= 12.1' if respond_to?(:chef_version)
==========================================================
recipes
#
# Cookbook:: kubernetes
# Recipe:: default
#
# Copyright:: 2017, The Authors, All Rights Reserved.
template '/etc/yum.repos.d/kubernetes.repo' do
source 'etc/yum.repos.d/kubernetes.repo'
owner 'root'
group 'root'
mode '0644'
end
template '/opt/clusterrole.yml' do
source 'opt/clusterrole.yml'
owner 'root'
group 'root'
mode '0644'
end
bash 'systemctl_daemon-reload' do
code <<-EOH
systemctl daemon-reload
EOH
action :nothing
end
execute "disable selinux - running" do
command "/usr/sbin/setenforce 0"
end
execute 'Disable selinux' do
command "sed -i --follow-symlinks 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux"
end
[
"kubeadm",
].each {|pkg|
package pkg do
========================================================================
/xxxxxx/xxxxxxxxx/src/xxxxxxx/cookbooks/kubernetes/templates/default/etc/systemd/system/docker.service.d
cat override.conf
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd overlay
============================================================
/xxxxxx/xxxxxxx/xxxx/xxxxxx/cookbooks/kubernetes/templates/default/opt
cat clusterrole.yml
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: kubernetes-dashboard
labels:
k8s-app: kubernetes-dashboard
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: kubernetes-dashboard
namespace: kube-system
========================================================================
No comments:
Post a Comment