Skip to content

Instantly share code, notes, and snippets.

### Vault Agent on Windows - https://learn.hashicorp.com/tutorials/vault/agent-windows-service?in=vault/app-integration
## Run Powershell as administrator
$amiadmin = [bool](([System.Security.Principal.WindowsIdentity]::GetCurrent()).groups -match "S-1-5-32-544")
If ($amiadmin -ne 'True') {"This script needs to be run as Administrator, exiting.."; Start-Sleep -s 5; exit}
Else {"Script running as Administrator, continuing..."; Start-Sleep -s 5}
## Check if vault-agent path exists, if not create it
New-Item -ItemType Directory -Force -Path c:\vault-agent
## Check if vault program exits, if not create it: Download Vault: https://www.vaultproject.io/downloads
$testpath = Test-Path C:\vault-agent\vault.exe
If ($testpath -ne 'True') {[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest https://releases.hashicorp.com/vault/1.8.2/vault_1.8.2_windows_amd64.zip -OutFile c:\vault-agent\vault_1.8.2_windows_amd64.zip; Expand-Archive -LiteralPath c:\vault-agent\vault_1.8.2_wind
@Vertiwell
Vertiwell / gist:5fd2c301872d058672e79c93ad6399af
Last active November 12, 2021 03:57
openebs-cstor/cstor
#!/bin/bash
### Deploying OpenEBS on Kubernetes for Debian/Ubuntu based OS
## Baseline Guide: https://github.com/openebs/cstor-operators/blob/develop/docs/quick.md
# Type of Deployment: Helm
### Minimum Requirements ###
## Three Worker Node Cluster (Tested on K0s, K3s, K8s)
## Each worker node must have a blank drive to consume, if you need to wipe said drives, use: dd if=/dev/zero of=/dev/sdb bs=1M
#
## The following base packages are required:
@Vertiwell
Vertiwell / gist:fc5a07c5fbf23964aabb32a303dc6b48
Created October 21, 2021 03:13
consul hashicorp/consul
# Install Vault CLI
curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add - && apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" && apt-get update && apt-get install vault
# Grab the Helm chart repo
helm repo add hashicorp https://helm.releases.hashicorp.com && helm repo update
# Create custom values file for Consul (Used as backend storage)
# Helm Chart Values Consul: https://github.com/hashicorp/consul-helm/blob/master/values.yaml
printf "server:\n resources:\n requests:\n memory: '512Mi'\n cpu: '500m'\n limits:\n memory: '512Mi'\n cpu: '500m'\n storageClass: 'cstor-csi'\n storage: 2Gi\nclient:\n resources:\n requests:\n memory: '512Mi'\n cpu: '500m'\n limits:\n memory: '512Mi'\n cpu: '500m'\nui:\n enabled: true\nconnectInject:\n enabled: true\n default: true\ncontroller:\n enabled: true\n" > config.yaml
helm install consul hashicorp/consul -f config.yaml
#!/bin/bash
### Deploying k0s for Debian/Ubuntu based OS
## Baseline Guide: https://github.com/k0sproject/k0sctl#installation
# Type of Deployment: Self - Baremetal
### Minimum Requirements ###
## This deployment requires at least 4 nodes, one to be the controller and three to be workers, this allows apps deployed to works to have a quorum.
## Each node must have passwordless SSH, using a root user (but not root itself) add the following on each node:
# printf "username ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
#
### Installation Steps ###
#!/bin/bash
### Deploying k3s for Debian/Ubuntu based OS
## Baseline Guide: https://github.com/alexellis/k3sup
# Type of Deployment: Self - Baremetal
### Minimum Requirements ###
## This deployment requires at least 4 nodes, one to be the controller and three to be workers, this allows apps deployed to works to have a quorum.
## Each node must have passwordless SSH, using a root user (but not root itself) add the following on each node:
# printf "username ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
#
### Installation Steps ###
#!/bin/bash
### Deploying Longhorn on Kubernetes for Debian/Ubuntu based OS
## Baseline Guide: https://longhorn.io/docs/1.2.2/deploy/install/install-with-helm/
# Type of Deployment: Helm
### Minimum Requirements ###
## Three Worker Node Cluster (Tested on K0s, K3s, K8s)
## Each worker node must have a blank drive to consume, if you need to wipe said drives, use: dd if=/dev/zero of=/dev/sdb bs=1M
#
## The following base packages are required:
@Vertiwell
Vertiwell / gist:1dde24a1c4071d1fde8b0028351ff0b7
Last active November 15, 2021 01:01
longhorn-ext-access.sh
#!/bin/bash
### Longhorn Dashboard
## Create SSL access to the Longhorn dashboard
## Set Variables:
# Get the Cert-Manager Issuer
ISSUER=$(kubectl get clusterissuer -o json | jq -r ".items[].metadata.name")
# Set a domain to use (needs to be real if you want to access this externally from the internet)
echo "Provide a domain to use (i.e: example.com):"
read DOMAIN
# Name of the application
#!/bin/bash
### Deploying Cert-Manager on Kubernetes for Debian/Ubuntu based OS
## Baseline Guide: https://cert-manager.io/docs/installation/helm/
# Type of Deployment: Helm
### Minimum Requirements ###
## Three Worker Node Cluster (Tested on K0s, K3s, K8s)
## No Vault script installation (Vault script deploys cert-manager, although it won't hurt to deploy both)
#
## The following base packages are required:
#!/bin/bash
### Deploying Hashicorp Consul on Kubernetes for Debian/Ubuntu based OS
## Baseline Guide: https://learn.hashicorp.com/tutorials/consul/kubernetes-deployment-guide
# Type of Deployment: Helm
### Minimum Requirements ###
## Three Worker Node Cluster (Tested on K0s, K3s, K8s)
## A Storage Backend (Tested on Ceph, OpenEBS, Local, Longhorn)
#
## The following base packages are required:
@Vertiwell
Vertiwell / gist:5384a24ae660ef386108b13df50033f0
Created November 12, 2021 04:05
hashicorp_consul-ext-access.sh
#!/bin/bash
### Consul Dashboard
## Create SSL access to the Consul dashboard
## Set Variables:
# Get the Cert-Manager Issuer
ISSUER=$(kubectl get clusterissuer -o json | jq -r ".items[].metadata.name")
# Set a domain to use (needs to be real if you want to access this externally from the internet)
echo "Provide a domain to use (i.e: example.com):"
read DOMAIN
# Name of the application