This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: v1 | |
| kind: Pod | |
| metadata: | |
| name: security-context-demo | |
| spec: | |
| containers: | |
| - name: sec-ctx-demo | |
| image: busybox:1.28 | |
| command: [ "sh", "-c", "sleep 1h" ] | |
| securityContext: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ╷ | |
| │ Error: Unsupported attribute | |
| │ | |
| │ on main.tf line 96, in resource "azurerm_route_table" "route_tables": | |
| │ 96: address_prefix = each.value.address_prefix | |
| │ ├──────────────── | |
| │ │ each.value is object with 2 attributes | |
| │ | |
| │ This object does not have an attribute named "address_prefix". | |
| ╵ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| nodes=$(kubectl get nodes --no-headers | awk '{print $1}') | |
| for n in ${nodes[@]}; do | |
| pods=$(kubectl get pod -A --field-selector spec.nodeName=$n --no-headers | awk '{print $2}') | |
| echo $n = $(echo $pods | wc -w) | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "math/rand" | |
| "time" | |
| ) | |
| func fib(ch chan string, number float64) { | |
| x, y := 1.0, 1.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "strconv" | |
| ) | |
| func fizzbuzz(num int) string { | |
| switch { | |
| case num%15 == 0: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| kubectl get nodes -o=custom-columns=NAME:.metadata.name,CAPACITY:.status.capacity.pods |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resource "azurerm_kubernetes_cluster_node_pool" "np" { | |
| name = var.node_pool_name | |
| kubernetes_cluster_id = azurerm_kubernetes_cluster.k8s.id | |
| vm_size = var.np_size | |
| node_count = var.np_count | |
| enable_auto_scaling = var.np-enable_auto_scaling | |
| max_count = var.np-enable_auto_scaling_max_count | |
| min_count = var.np-enable_auto_scaling_min_count | |
| zones = (var.np-availability_zones == "") ? [] : split(",", var.np-availability_zones) | |
| max_pods = var.np-max_pods |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Simple GET example | |
| $response = Invoke-RestMethod 'http://example.com/api/people' | |
| # assuming the response was in this format { "items": [] } | |
| # we can now extract the child people like this | |
| $people = $response.items | |
| GET with custom headers example | |
| $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" | |
| $headers.Add("X-DATE", '9/29/2014') | |
| $headers.Add("X-SIGNATURE", '234j123l4kl23j41l23k4j') | |
| $headers.Add("X-API-KEY", 'testuser') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Summary: | |
| Run tcpdump on a pod and then see that information through Wireshark locally on my machine. | |
| Topology | |
| -------- | |
| [laptop with wireshark] ------> [AKS Node] ------> [POD (tcpdump is here)]. | |
| ##1. Create the fifo on your local machine (where wireshark will run) | |
| ``` | |
| mkfifo /tmp/remote-capture.fifo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Diagnostics; | |
| string path = @"C:\Path\to\your\file.txt"; | |
| ProcessStartInfo processInfo = new ProcessStartInfo(); | |
| processInfo.FileName = @"powershell.exe"; | |
| processInfo.Arguments = $@"-Command $ErrorActionPreference = 'Stop'; $VerbosePreference = 'Continue'; $ProgressPreference = 'SilentlyContinue'; | |
| $fi = Get-ItemProperty -Path '{path}'; | |
| $ShellApplication = New-Object -ComObject Shell.Application; | |
| $ShellFolder = $ShellApplication.Namespace($fi.Directory.FullName); |