Puppet+Kubernetes: Setting up the environment to use kubernetes in puppet

0 votes

I have installed the puppetlabs/kubernetes module in order to use it to manage my kubernetes cluster. But how do I setup the environment? 

what's the procedure to configure my node? I need help with the setup.

Aug 21 in Puppet by Karan
• 2,080 points
15 views

1 answer to this question.

0 votes

As you have already installed the module, the next steps would be:

  • Generate the configuration

  • Add theOS and hostname yaml files to Hiera

  • Configure your node

This module has Kubetool a configuration tool that auto-generates the Hiera security parameters, the discovery token hash, and other configurations for your Kubernetes cluster. To simplify installation and use, the tool is available as a Docker image.

Generating the module configuration:

If Docker is not installed on your workstation, install it.

The Kubetool Docker image takes each parameter as an environment variable.

Note:: The version of Kubetool you use must match the version of the module on the Puppet Forge. 

To output a yaml file into your working directory that corresponds to the operating system you want Kubernetes to run on, and for each controller node, run either of these docker run commands:

docker run --rm -v $(pwd):/mnt --env-file env puppet/kubetool:{$module_version}

The docker run command above includes an env file which is included in the root folder of this repo.

docker run --rm -v $(pwd):/mnt -e OS=debian -e VERSION=1.10.2 -e CONTAINER_RUNTIME=docker -e CNI_PROVIDER=cilium -e CNI_PROVIDER_VERSION=1.4.3 -e ETCD_INITIAL_CLUSTER=kube-master:172.17.10.101,kube-replica-master-01:172.17.10.210,kube-replica-master-02:172.17.10.220 -e ETCD_IP="%{::ipaddress_eth1}" -e KUBE_API_ADVERTISE_ADDRESS="%{::ipaddress_eth1}" -e INSTALL_DASHBOARD=true puppet/kubetool:{$module-version}

Adding the {$OS}.yaml and {$hostname}.yaml files to Hiera:

Add the {$OS}.yaml file to the same control repo where your Hiera data is, usually the data directory. By leveraging location facts, such as the pp_datacenter trusted_fact each cluster can be allocated its own configuration.

Configuring your node:

After the {$OS}.yaml and {$hostname}.yaml files have been added to the Hiera directory on your Puppet server, configure your node as the controller or worker.

A controller node contains the control plane and etcd

In a production cluster, you should have three, five, or seven controllers. A worker node runs your applications. You can add as many worker nodes as Kubernetes can handle. 

And you are good to go!

answered Aug 21 by Sirajul
• 26,100 points

Related Questions In Puppet

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to change the run interval in puppet?

To check the run interval run the following ...READ MORE

answered Jul 29 in Puppet by Sirajul
• 26,100 points
21 views
0 votes
1 answer
0 votes
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17 in Others by anonymous
2,182 views
+3 votes
1 answer
0 votes
1 answer

How to check the installed modules in puppet?

Puppet Module list command will list all ...READ MORE

answered Jul 24 in Puppet by Sirajul
• 26,100 points
37 views
0 votes
1 answer

How can i avoid the "environment leakage" in puppet?

Environment leakage is one of the limitations ...READ MORE

answered Jul 25 in Puppet by Sirajul
• 26,100 points
27 views