Skip to the content.

Kubernetes_RFD

Multiple Kubernetes projects for all kinds of problems.

Prerequisites

You need to have a Kubernetes cluster available.

If you do not have one, you can virtualize with tools such as minikube in version v1.16.0 or higher. https://github.com/kubernetes/minikube

All the custom images that will be used in this repository have been generated by dockerfile or similar files from the following repository: https://github.com/JoseManuelPS/Docker_RFD

It is recommended to have a proprietary image repository such as Docker Registry or Nexus to facilitate the image management task.

ansible/basic:v1.0

This short tutorial explains in a simple way how to deploy an ansible laboratory based on https://github.com/JoseManuelPS/Docker_RFD ansible/basic.

Note: To mount volumes in minikube please use the following args. –mount=true –mount-string=’/home/josemanuelps/projects:/home/docker/projects’

kubectl create --save-config -f <(path_to_ansible_namespaces)>
kubectl apply -f <(path_to_ansible_directory)>

Example deploy instrucctions:

kubectl create --save-config -f ~/projects/kubernetes_rfd/ansible/basic/ns.ansible.yaml
kubectl apply -f ~/projects/kubernetes_rfd/ansible/basic

Last test info:


ansible/root:v1.0

This short tutorial explains in a simple way how to deploy an ansible laboratory based on https://github.com/JoseManuelPS/Docker_RFD ansible/root.

Note: To mount volumes in minikube please use the following args. –mount=true –mount-string=’/home/josemanuelps/projects:/home/docker/projects’

kubectl create --save-config -f <(path_to_ansible_namespaces)>
kubectl apply -f <(path_to_ansible_directory)>

Example deploy instrucctions:

kubectl create --save-config -f ~/projects/kubernetes_rfd/ansible/root/ns.ansible.yaml
kubectl apply -f ~/projects/kubernetes_rfd/ansible/root

Last test info:


botnet_generator:v1.0

This short tutorial explains in a simple way how to deploy a botnet using the script botnget_generator.py.

Note: To mount volumes in minikube please use the following args. –mount=true –mount-string=’/home/josemanuelps/projects:/home/docker/projects’

kubectl create --save-config -f <(path_to_ansible_namespaces)>
kubectl apply -f <(path_to_ansible_directory)>

Example deploy instrucctions for master [Master controller]:

kubectl create --save-config -f ~/projects/kubernetes_rfd/botnet_generator/master/ns.botnet.yaml
kubectl apply -f ~/projects/kubernetes_rfd/botnet_generator/master/
kubectl create --save-config -f <(path_to_namespaces)>

Example deploy instrucctions of namespace [Bots cluster]:

kubectl create --save-config -f ~/projects/kubernetes_rfd/botnet_generator/master/ns.botnet.yaml
python3 ~/projects/kubernetes_rfd/botnet_generator/botnet_generator.py [-h] [--name NAME] [--num NUM] path

Example instrucctions to create a new botnet [Bots cluster]:

python3 ~/projects/kubernetes_rfd/botnet_generator/botnet_generator.py --name test --num 10 new_botnet
sudo <(new_botnet_path)>/rules/iptables.sh

Example instrucctions to apply new iptables rules [Bots cluster]:

sudo ./new_botnet/rules/iptables.sh
kubectl apply -f <(new_botnet_path)>

Example instrucctions to deploy botnet [Bots cluster]:

kubectl apply -f new_botnet

Last test info:


nexus_repository_oss/minikube:v1.1

This short tutorial explains in a simple way how to deploy the Nexus Repository OSS image repository (https://www.sonatype.com/nexus/repository-oss) inside of minikube.

Start minikube with the parameter –insecure-registry, like this:

minikube start --insecure-registry 'docker.local:30500'

Add minikube ip to the /etc/hosts file with the following names:

Use the following command to check it:

minikube ip

You must also enable the ingress addon. Use the following command to add it.

minikube addons enable ingress

Important: A deployment is going to be carried out without certificates, if you want to carry out a deployment with certificates you can find more information at: https://help.sonatype.com/repomanager3

kubectl create --save-config -f <(path_to_nexus_namespaces)>
kubectl create --save-config -f <(path_to_nexus_deployment)> -f <(path_to_nexus_service)> -f <(path_to_nexus_ingress)>

Example deploy instrucction:

kubectl create --save-config -f ~/projects/kubernetes_rfd/nexus_repository_oss/minikube/ns.nexus_repository.yaml
kubectl apply -f ~/projects/kubernetes_rfd/nexus_repository_oss/minikube/

Configure and access to your own Nexus Repository OSS.

Now your Nexus Repository OSS it’s ready. To use it, you must access to http://nexus.local:30501 address, log in as admin, and complete the initial setup.

Once you have successfully logged in, go to Settings>Security>Realms and enable Docker Bearer Token Realm.

After the configuration is complete, you must create a new Docker repository as type hosted with the http port 5000 and Allow anonymous docker pull enabled.

Once the deployment has been done, and the new Docker repository created you can connect to it following this steps:

{
    "insecure-registries": ["docker.local:30500"]
}
docker tag <(image_name:version)> docker.local:30500/<(repository_name)>/<(image_name:version)>
docker push docker.local:30500/<(repository_name)>/<(image_name:version)>

Example push instrucction:

docker tag hello_world:v1.0 docker.local:30500/docker_repo/hello_world:v1.0
docker push docker.local:30500/docker_repo/hello_world:v1.0
docker pull docker.local:30500/<(repository_name)>/<(image_name:version)>

Example pull instrucction:

docker pull docker.local:30500/docker_repo/hello_world:v1.0

Last test info: