Skip to content

Instantly share code, notes, and snippets.

@dmusicant-dk
dmusicant-dk / install-hyper-v
Created January 20, 2021 22:31
Installing Hyper-V from Powershell
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
@dmusicant-dk
dmusicant-dk / install-minikube-macosx
Last active January 20, 2021 22:44
Install and Start Minikube on MacOSX
# Install virtual box (this will be used to run Minikube)
brew install cask && brew install --cask virtualbox
# Install Minikube
brew install minikube
# Start minikube
minikube start --driver=virtualbox
@dmusicant-dk
dmusicant-dk / install-minikube-windows
Last active January 20, 2021 22:43
Install and Start Minikube on Windows
# Install from Chocolatey
choco install minikube
# Start Minikube with the hyper-v driver (Windows)
minikube start --driver=hyperv
# Verify it's up
minikube status
# (When done, optional) Shut it down
@dmusicant-dk
dmusicant-dk / uninstall-minikube-windows
Created January 20, 2021 22:46
Uninstall Minikube On Windows
# Shut down
minikube stop
# Tell it to delete anything it created outside itself
minikube delete
# Use chocolatey to remove
Choco uninstall minikube
@dmusicant-dk
dmusicant-dk / kubectl-common-commands
Created January 20, 2021 22:52
Kubectl Common Commands
# See which clusters you have configured to connect to
kubectl config get-clusters
# Get info on the default cluster
kubectl cluster-info
# Get detailed info on the default cluster
kubectl cluster-info dump
# Some debugging commands
@dmusicant-dk
dmusicant-dk / contexts-output-from-kubectl
Created January 20, 2021 23:00
Contexts Output From Kubectl
# Run `kubectl config get-contexts`
# NOTE: Some of the names are elided as they're long
# OUTPUT:
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
arn:aws:eks:...:cluster/eks-poc-dev arn:aws:eks:...:cluster/eks-poc-dev arn:aws:eks:...:cluster/eks-poc-dev
docker-desktop docker-desktop docker-desktop
* minikube minikube minikube default
@dmusicant-dk
dmusicant-dk / k8s-clusters-vs-contexts
Created January 20, 2021 23:04
Using K8s Clusters vs Contexts
# Find out the contexts you've configured and which is the default
# (will be the one with the asterisk)
kubectl config get-contexts
# Get detailed info on a specified cluster
kubectl cluster-info dump --context=minikube
# Set cluster for a specific command
export CLUSTER=minikube
kubectl cluster-info dump --context=${CLUSTER}
@dmusicant-dk
dmusicant-dk / data-layer-namespace.yaml
Last active January 20, 2021 23:25
data-layer-namespace.yaml
# This is the version for the Kubernetes API for the thing being
# defined here, i.e. the "kind" (in this case, a namespace). You
# might end up with different YAMLs deployed into the same K8s
# cluster that all use different apiVersion numbers.
apiVersion: v1
# This is the type of "object" we're asking Kubernetes to install
# and keep healthy within the cluster.
kind: Namespace
@dmusicant-dk
dmusicant-dk / create-data-layer-namespace.yaml
Created January 20, 2021 23:11
Create data-layer-namespace.yaml
kubectl apply -f data-layer-namespace.yaml
@dmusicant-dk
dmusicant-dk / powershell-base64-encode-user-pass
Created January 21, 2021 17:48
Bse64 Encode Username/Password with Powershell
# Base64 encode the username "root"
$userBytes = [System.Text.Encoding]::UTF8.GetBytes("root"); [System.Convert]::ToBase64String($userBytes)
# Base64 encode the password "dbpassword1"
$userBytes = [System.Text.Encoding]::UTF8.GetBytes("dbpassword1"); [System.Convert]::ToBase64String($userBytes)