Skip to content

Instantly share code, notes, and snippets.

View sixeyed's full-sized avatar

Elton Stoneman sixeyed

View GitHub Profile
az aks nodepool add -g $rgName --cluster-name $aksName `
-n $nodePoolName `
--mode User `
--enable-cluster-autoscaler `
--node-count 1 `
--min-count 0 `
--max-count $nodeMaxCount `
--node-osdisk-size $aksNodeDiskSize `
--node-vm-size $nodeVmSize `
--vnet-subnet-id $subnetId `
{"keys":[{"kty":"RSA","use":"sig","kid":"-KI3Q9nNR7bRofxmeZoXqbHZGew","x5t":"-KI3Q9nNR7bRofxmeZoXqbHZGew","n":"tJL6Wr2JUsxLyNezPQh1J6zn6wSoDAhgRYSDkaMuEHy75VikiB8wg25WuR96gdMpookdlRvh7SnRvtjQN9b5m4zJCMpSRcJ5DuXl4mcd7Cg3Zp1C5-JmMq8J7m7OS9HpUQbA1yhtCHqP7XA4UnQI28J-TnGiAa3viPLlq0663Cq6hQw7jYo5yNjdJcV5-FS-xNV7UHR4zAMRruMUHxte1IZJzbJmxjKoEjJwDTtcd6DkI3yrkmYt8GdQmu0YBHTJSZiz-M10CY3LbvLzf-tbBNKQ_gfnGGKF7MvRCmPA_YF_APynrIG7p4vPDRXhpG3_CIt317NyvGoIwiv0At83kQ","e":"AQAB","x5c":["MIIDBTCCAe2gAwIBAgIQGQ6YG6NleJxJGDRAwAd/ZTANBgkqhkiG9w0BAQsFADAtMSswKQYDVQQDEyJhY2NvdW50cy5hY2Nlc3Njb250cm9sLndpbmRvd3MubmV0MB4XDTIyMTAwMjE4MDY0OVoXDTI3MTAwMjE4MDY0OVowLTErMCkGA1UEAxMiYWNjb3VudHMuYWNjZXNzY29udHJvbC53aW5kb3dzLm5ldDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALSS+lq9iVLMS8jXsz0IdSes5+sEqAwIYEWEg5GjLhB8u+VYpIgfMINuVrkfeoHTKaKJHZUb4e0p0b7Y0DfW+ZuMyQjKUkXCeQ7l5eJnHewoN2adQufiZjKvCe5uzkvR6VEGwNcobQh6j+1wOFJ0CNvCfk5xogGt74jy5atOutwquoUMO42KOcjY3SXFefhUvsTVe1B0eMwDEa7jFB8bXtSGSc2yZsYyqBIycA07XHeg5CN8q5JmLfBnUJrtGAR0yUmYs/jNdAmNy27y83/rWw
from azure.keyvault.secrets import SecretClient
from azure.identity import DefaultAzureCredential
keyVaultName = input("Enter Key Vault name:")
KVUri = f"https://{keyVaultName}.vault.azure.net"
secretName = "mySecret"
credential = DefaultAzureCredential()
client = SecretClient(vault_url=KVUri, credential=credential)
retrieved_secret = client.get_secret(secretName)
param(
[string] $sqlServerName,
[string] $sqlPassword
)
Start-Transcript -path C:\vm-setup.log
Write-Output '* Setup starting'
Write-Output '** Installing Windows features'
param(
[string] $sqlServerName,
[string] $sqlPassword
)
Write-Output '* Setup starting'
Write-Output '** Installing Windows features'
Install-WindowsFeature Web-Server,NET-Framework-45-ASPNET,Web-Asp-Net45
Write-Output '* Installing Chocolatey'
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Write-Output '* Installing tools'
choco install -y git
choco install -y vscode
Write-Output '-VM setup script done-'
@sixeyed
sixeyed / job.sh
Created June 24, 2019 17:15
Jenkins snippet for remote building on a Docker Swarm node
build_and_push() {
ip=$1
os=$2
arch=$3
docker \
--host tcp://$ip:2376 --tlsverify --tlscacert $ca --tlscert $cert --tlskey $key \
image build --pull -t org/repo:$os-$arch .
@sixeyed
sixeyed / job.sh
Created June 24, 2019 17:15
Jenkins snippet for remote building on a Docker Swarm node
build_and_push() {
ip=$1
os=$2
arch=$3
docker \
--host tcp://$ip:2376 --tlsverify --tlscacert $ca --tlscert $cert --tlskey $key \
image build --pull -t org/repo:$os-$arch .
@sixeyed
sixeyed / windows_on_kube_dceu.md
Created November 30, 2018 13:25 — forked from wsong/windows_on_kube_dceu.md
Kube on Windows demo for DCEU

Windows on Kube

NOTE: This is based on the gist https://gist.github.com/wsong/34beb37ebd5d22c1bf1266aaeea085d4. That gist was used to set up the Dockercon SF demo; this one is for Dockercon EU 2018.

The below instructions describe how to set up a cluster with one Linux manager and one Windows worker such that you can schedule Kubernetes pods with Windows images on the Windows worker.

These instructions are for a Windows Server 2019 node. You can create these nodes on Azure (as of November 27, 2018).

On Azure, I recommend VMs of size D4s v3 or larger (4 CPUs, 16GB memory)

@sixeyed
sixeyed / profile.ps1
Created November 1, 2018 11:25
PowerShell profile with a Linux-style prompt and aliases for common Docker commands
function Prompt(){
$W = Split-Path -leaf -path (Get-Location)
$prompt = Write-Prompt "$($env:UserName)@$($env:ComputerName):" -ForegroundColor Green
$prompt += Write-Prompt $W -ForegroundColor DarkCyan
$prompt += Write-Prompt '>'
return ' '
}
function Remove-StoppedContainers {
docker container rm $(docker container ls -q)