Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#Create and describe an alpine and an nginx pod then delete pods
#Create and describe alpine pod
echo “apiVersion: v1
kind: Pod
metadata:
name: alpine
namespace: default
spec:
containers:
#!/bin/bash
#Creates two kubernetes jobs using yaml config and displays the description and log of the job
echo “apiVersion: batch/v1
kind: Job
metadata:
name: pi
spec:
template:
spec:
containers:
#install kubernetes on CentOS
#run as root
#kubernetes will refuse to run on CentOS if swapoff is on
#line 1 & 2 ensure swapoff doesn’t interfere with k8
swapoff -a
sed -i '/ swap swap /s/^/#/' /etc/fstab
yum -y update
yum -y install docker
systemctl enable docker && systemctl start docker
echo “[kubernetes]
@joshy91
joshy91 / kubeMasterFlannelCNI.sh
Last active July 12, 2018 06:01
Initiate Kubernetes Master using flannel for CNI
#!/bin/bash
#Initiate Kubernetes Master using flannel for CNI
#Run command as regular user
sudo kubeadm init --pod-network-cidr=10.244.0.0/16
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
#Install and start flannel for CNI on pods
#!/bin/bash
#install kubernetes on ubuntu
#run commands as root
apt-get upgrade
apt-get install docker.io
echo “{
"exec-opts": ["native.cgroupriver=systemd"]
}” >> /etc/docker/daemon.json
apt-get install curl
#!/bin/bash
#Installs Java 8 and Jenkins on Debian based machine such as Ubuntu
#Run if a java version greater than java 8 is installed
#sudo apt-get -y remove java
sudo apt-get -y install java-1.8.0-openjdk
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
#Appends sources lists to include jenkins pkg repo
echo 'deb https://pkg.jenkins.io/debian binary/' >> /etc/apt/sources.list
@joshy91
joshy91 / jenkinsInstall
Last active July 11, 2018 20:20
Install Jenkins on Centos7
#!/bin/bash
#Installs Java 8 and Jenkins on CentOS7
#Run if a java version greater than java 8 is installed
#sudo apt-get -y remove java
sudo yum -y install java-1.8.0-openjdk
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
@joshy91
joshy91 / dockerInstall
Last active July 11, 2018 20:29
Install Docker.ce on Centos7
#!/bin/bash
yum update
yum install docker
systemctl enable docker && systemctl start docker && systemctl status docker
#Replace *user* with actual user name
usermod -aG docker user