Skip to content

Instantly share code, notes, and snippets.

View dbafromthecold's full-sized avatar

Andrew Pruski dbafromthecold

View GitHub Profile
@dbafromthecold
dbafromthecold / testnginxingress.yaml
Created November 21, 2020 11:30
Test nginx ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-testwebsite
annotations:
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- host: www.testwebaddress.com
http:
@dbafromthecold
dbafromthecold / DecodeHelmSecrets.sh
Created August 16, 2020 13:06
A kubectl plugin to decode secrets created by Helm
#!/bin/bash
# get helm secrets from Kubernetes cluster
SECRET=$(kubectl get secret $1 -o jsonpath='{ .data.release }' )
# decode the secrets
DECODED_SECRET=$(echo $SECRET | base64 -d | base64 -d | gunzip -c )
# parse the decoded secrets, pulling out the templates and removing whitespace
DATA=$(echo $DECODED_SECRET | jq '.chart.templates[]' | tr -d '[:space:]' )
@dbafromthecold
dbafromthecold / sqlserver_pod_eviction_demo.yaml
Last active February 11, 2022 23:02
Deployment yaml for testing a pod eviction in kubernetes
apiVersion: apps/v1
kind: Deployment
metadata:
name: sqlserver2019-deployment
spec:
replicas: 1
selector:
matchLabels:
name: sqlserver2019-pod
template:
@dbafromthecold
dbafromthecold / mysql_docker
Last active February 7, 2020 17:50
Run mysql in a docker container
docker container run `
-d ` # detach the container (run it in the background)
--name arkkkd ` # give the container a name (arkkkd)
-p 3306:3306 ` # set port mapping from your computer to the container (3306 to 3306)
# setting environment variables for mysql
--env MYSQL_ALLOW_EMPTY_PASSWORD=True `
@dbafromthecold
dbafromthecold / docker-compose.yaml
Created December 30, 2019 14:38
Spinning SQL Server 2019 up with docker-compose
version: '3.7'
services:
sqlserver1:
build:
context: .
dockerfile: dockerfile
ports:
- "15789:1433"
env_file:
@dbafromthecold
dbafromthecold / PsDatabaseCloneContainer.ps1
Last active October 9, 2019 10:03
Using PSDatabaseClone to clone database into container
# hack to use PsDatabaseClone to mount a cloned database into a container
# this only works with a local SQL instance to initially host the cloned database
# which is then detached and mounted to a container
# import required powershell modules
import-module dbatools
import-module psframework
import-module psdatabaseclone
@dbafromthecold
dbafromthecold / InstallK8sOnRaspberryPi.txt
Last active March 21, 2020 23:38
Steps to install K8s on a raspberry pi 4 running Raspbian Buster Lite
# https://github.com/teamserverless/k8s-on-raspbian/blob/master/script/prep.sh
# https://www.hanselman.com/blog/HowToBuildAKubernetesClusterWithARMRaspberryPiThenRunNETCoreOnOpenFaas.aspx
# config of the raspberry pi on the network
change hostname
change ip
disable swap
# raspbian claiming it's debian v10 when it's actually v9 - curl -sL get.docker.com | grep '9)' -b10 -a10 - no version for buster
sudo curl -sL get.docker.com | sed 's/9)/10)/' | sh
@dbafromthecold
dbafromthecold / dockerfile
Created November 5, 2018 19:46
Dockerfile to install SQL Server on Centos
FROM centos
RUN yum update -y && yum install -y curl sudo
RUN sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2017.repo
RUN yum install -y mssql-server
CMD /opt/mssql/bin/sqlservr
@dbafromthecold
dbafromthecold / SqlServer_Helm_Test.azcli
Last active December 14, 2018 15:31
Setting up a helm chart to deploy SQL Server to a K8s cluster
# create directory for helm
cd C:\git\dbafromthecold\PrivateCodeRepo\Azure\Helm
# create new chart
helm create testsqlchart
@dbafromthecold
dbafromthecold / delete_aci-virtualnetwork.azcli
Created October 6, 2018 13:50
delete_aci-virtualnetwork
# https://docs.microsoft.com/en-us/azure/container-instances/container-instances-vnet
# log into Azure
az login
# Set variables for resource group, virtual network, and subnet
RES_GROUP=containers1
VNET=vnet1