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 / cks-book-system-hardening.sh
Last active January 26, 2024 18:00
CKS Exam Book - System Hardening - Chapter 4
######################################
######### DISABLING SERVICES #########
######################################
# view running services
systemctl | grep running
# view state of snapd service
systemctl status snapd
# stop the snapd service
@chadmcrowell
chadmcrowell / dallas-k8s-workshop-configmaps.sh
Created October 19, 2023 21:32
Dallas Kubernetes Workshop - ConfigMaps
# use the following lab environment:
# https://studyk8s.club/cka-configmaps
# create the configmap
cat << EOF > redis-configMap.yaml
apiVersion: v1
data:
redis-config: |
maxmemory: 2mb
maxmemory-policy: allkeys-lru
@chadmcrowell
chadmcrowell / dallas-k8s-workshop-logging.sh
Created October 19, 2023 21:07
Dallas Kubernetes Workshop - Logging
# perform the commands from this lab environment:
# https://studyk8s.club/cka-logging
# create a pod that will output logs to stdout
cat << EOF > pod-logging.yaml
apiVersion: v1
kind: Pod
metadata:
name: pod-logging
spec:
@chadmcrowell
chadmcrowell / dallas-k8s-workshop-upgrade-k8s.sh
Created October 19, 2023 21:01
Dallas Kubernetes Workshop - Upgrade K8s
# perform the command from this lab environment:
# https://studyk8s.club/cka-upgrade-k8s
# plan the upgrade
kubeadm upgrade plan
# upgrade the version of kubeadm
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl gpg
mkdir -p /etc/apt/keyrings/
@chadmcrowell
chadmcrowell / dallas-k8s-workshop-create-user.sh
Created October 19, 2023 16:02
Dallas Kubernetes Workshop - Create New User
# perform the commands from the following lab environment:
# https://studyk8s.club/cka-new-user
# view the config
k config-view
cat ~/.kube/config
echo $KUBECONFIG
cat /etc/kubernetes/admin.conf
# list the cluster users
@chadmcrowell
chadmcrowell / dallas-k8s-workshop-etcd-backup.sh
Created October 18, 2023 19:20
Dallas Kubernetes Workshop - Etcd Backup
# perform the commands from the following lab environment:
# https://studyk8s.club/cka-ectd-backup
# set etcdctl environment variable api to version 3
export ECTDCTL_API=3
# etcd help menu
etcdctl snapshot -h
# backup etcd
@chadmcrowell
chadmcrowell / dallas-k8s-workshop-warmup.sh
Created October 18, 2023 18:56
Dallas Kubernetes Workshop - Warmup
# perform the commands from the following site:
# https://studyk8s.club/cka-warmup
# list all the api resources
k api-resources
# help menu is your friend
k -h
# help menu goes many levels deep
@chadmcrowell
chadmcrowell / config.yaml
Created October 14, 2023 14:54
Online Boutique App
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: email-service
name: email-service
spec:
replicas: 1
selector:
matchLabels:
@chadmcrowell
chadmcrowell / install-prometheus-and-grafana-operator.sh
Created October 10, 2023 15:07
Installing the Prometheus and Grafana Operator
# add bitnami repo for access to prometheus helm chart
helm repo add bitnami https://charts.bitnami.com/bitnami
# install prometheus operator via helm chart
helm install prometheus bitnami/kube-prometheus
# watch as pods are created
kubectl get po -w
# customize the helm chart for grafana dashboard
@chadmcrowell
chadmcrowell / install-helm-linux.sh
Created October 6, 2023 14:58
Install Helm on Linux
#!/bin/bash
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh