Skip to content

Instantly share code, notes, and snippets.

View abdennour's full-sized avatar
🌴
On vacation

abdennour abdennour

🌴
On vacation
View GitHub Profile
@abdennour
abdennour / README.md
Last active April 27, 2019 07:03
Kubernetes with enabeled firewall
@abdennour
abdennour / master.md
Created June 1, 2019 09:49
Kubernetes The easy way
  1. Initializes cluster master node:
 kubeadm init --apiserver-advertise-address $(hostname -i)
  1. Initialize cluster networking:
@abdennour
abdennour / authentication.sh
Last active June 15, 2019 13:58
Add New Kubernetes User with Role biding
#!/bin/bash
# Usage: $0 myuser
k_user=${1}
#...
# 1. Step one: This new User generate a private key
openssl genrsa -out ${k_user}.pem 2048
@abdennour
abdennour / install.sh
Created June 22, 2019 19:52
Install nginx on MacOs
brew install nginx
# Docroot is: /usr/local/var/www
# The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
# nginx can run without sudo.
# nginx will load all files in /usr/local/etc/nginx/servers/.
# To have launchd start nginx now and restart at login:
@abdennour
abdennour / README.md
Created July 2, 2019 06:13
Leverage Ansible inventory to SSH login

Configuration

Put the file alongside the ansible.cfg (root project)

Usage

invenotry example

192.168.11.23 ansible_host=mynode.example.com
@abdennour
abdennour / best.sh
Created July 19, 2019 06:52
Conditionally Append Arguments to call a command
# https://superuser.com/a/802544/217352
# http://mywiki.wooledge.org/BashFAQ/050#I_only_want_to_pass_options_if_the_runtime_data_needs_them
@abdennour
abdennour / install_jenkins_centos_redhat.sh
Created September 5, 2019 02:21
Jenkins Installation
#!/bin/bash
yum install -y java-1.8.0-openjdk-devel
yum install -y wget
wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo
rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
yum install -y jenkins
systemctl enable jenkins
systemctl start jenkins
@abdennour
abdennour / README.md
Created September 5, 2019 21:45
Secure Docker In Docker

To provide software in the form of Docker Images, it requires a build system and an infrastructure that creates the images as part of a Continuous Integration and, if necessary, stores them in a Docker Registry. For open source projects there are offers in the cloud, from Travis CI to build on Dockerhub itself. For in-house development, the infrastructure for the build is often called Jenkins, and with good reason. To install a Jenkins - whether for the whole company, the team or locally for testing - there are many ways.

An installation of operating system packages or ZIP archives is one possibility, but leaves many things open (eg the Java version) and may depend on the operating system. Obviously - and also very trendy - is starting Jenkins itself as a Docker container. Starting Jenkins in a container is easy. It is possible to run Docker in a container, but it does not matter which way it is connected to some configuration.

jenkins_in_docker_for_docker Jenkins in the container accesses the Docker Execut

@abdennour
abdennour / k8s_clean_exit_pods.sh
Created September 7, 2019 10:13
Clean Useless Pods
kubectl get po --all-namespaces --field-selector 'status.phase==Failed' -o json | kubectl delete -f -
kubectl get po --all-namespaces --field-selector 'status.phase==Evicted' -o json | kubectl delete -f -
kubectl get po --all-namespaces --field-selector 'status.phase==Pending' -o json | kubectl delete -f -
@abdennour
abdennour / df_k8s_nodes.sh
Last active September 7, 2019 18:15
Check K8s Nodes Disk Space without SSH
cat <<EOF | kubectl apply -f -
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: disk-checker
labels:
tier: monitoring
app: disk-checker
version: v1
spec: