Skip to content

Instantly share code, notes, and snippets.

View chadmcrowell's full-sized avatar
🏠
Working from home

Chad M. Crowell chadmcrowell

🏠
Working from home
View GitHub Profile
@chadmcrowell
chadmcrowell / kind-create-cluster-1.28.0.sh
Created October 5, 2023 17:55
Create 1.28 kind cluster
#!/bin/bash
kind create cluster —image kindest/node:v1.28.0 --name kind128
@chadmcrowell
chadmcrowell / bash-completion-kubectl.sh
Created October 5, 2023 14:49
bash autocomplete for kubectl
#!/bin/bash
apt update && apt install -y bash-completion
echo 'source <(kubectl completion bash)' >> ~/.bashrc
echo 'source /usr/share/bash-completion/bash_completion' >> ~/.bashrc
echo 'alias k=kubectl' >> ~/.bashrc
echo 'complete -o default -F __start_kubectl k' >> ~/.bashrc
source ~/.bashrc
@chadmcrowell
chadmcrowell / alias-and-bash-complete-for-kind.sh
Created August 31, 2023 20:35
Add 'k' alias and bash completion to Kind Clusters
#!/bin/bash
# from a shell to kind-control-plane
# install bash completion with apt package manager
apt update && apt install -y bash-completion
# add kubectl bash completion to bashrc
echo 'source <(kubectl completion bash)' >> ~/.bashrc
# add the source for bash completion to bashrc
kubectl run nginx --image nginx --dry-run=client -o yaml > pod.yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: nginx
name: nginx
spec:
containers:
- image: nginx
@chadmcrowell
chadmcrowell / install-gitlab.sh
Created August 16, 2023 21:16
Installing GitLab Server on Ubuntu
# install dependencies
sudo apt install -y curl openssh-server ca-certificates tzdata
# install smtp server
sudo apt install -y postfix
# add gitlab package to our local repository
curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
# install gitlab with external URL
@chadmcrowell
chadmcrowell / pod.yaml
Last active May 19, 2023 17:18
Apply Affinity - Kubernetes Pod
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: az1-pod
name: az1-pod
namespace: 012963bd
spec:
affinity:
@chadmcrowell
chadmcrowell / bash-completion-for-kubectl.sh
Created May 19, 2023 16:36
Bash Completion for Kubectl - Kubernetes CLI
# install bash-completion on debian
apt update && apt install -y bash-completion
# add the following lines to your .bashrc file
echo 'source <(kubectl completion bash)' >> ~/.bashrc
echo 'source /usr/share/bash-completion/bash_completion' >> ~/.bashrc
echo 'alias k=kubectl' >> ~/.bashrc
echo 'complete -o default -F __start_kubectl k' >> ~/.bashrc
# source your .bashrc
@chadmcrowell
chadmcrowell / pod-sleep.yaml.txt
Last active March 7, 2023 16:26
Pod with sleep command
cat <<EOF | k apply -f -
apiVersion: v1
kind: Pod
metadata:
name: sleep-pod
spec:
containers:
- name: pv-container
image: nginx
command: ["sh", "-c", "while true; do echo sync logs; sleep 2; done"]
@chadmcrowell
chadmcrowell / pod-with-vol.yaml.sh
Created February 28, 2023 17:43
Create and Apply Pod with attached volume - Kubernetes
cat <<EOF | k apply -f -
apiVersion: v1
kind: Pod
metadata:
name: pv-pod
spec:
containers:
- name: pv-container
image: nginx
volumeMounts: