kubectl --context kind-kind get service my-service -o yaml
apiVersion: v1
kind: Service
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
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: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: httpd-deployment | |
| labels: | |
| app: MyApp | |
| spec: | |
| replicas: 2 | |
| selector: | |
| matchLabels: |
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: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: httpd-deployment | |
| labels: | |
| app: MyDualApp | |
| spec: | |
| replicas: 2 | |
| selector: | |
| matchLabels: |
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
| # full credit https://dev.to/selfup/concurrent-tcp-server-in-go-4afp | |
| package main | |
| import ( | |
| "bufio" | |
| "fmt" | |
| "log" | |
| "net" | |
| ) |
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" | |
| "net" | |
| ) | |
| // broadcastAddress returns the broadcast address of the subnet | |
| func broadcastAddress(subnet *net.IPNet) net.IP{ | |
| n := len(subnet.IP) |
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
| # Create 2 network namespaces | |
| sudo ip netns add NorthNS | |
| sudo ip netns add SouthNS | |
| # Connect the namespaces using a veth pair | |
| sudo ip link add name vethSouth type veth peer name vethNorth | |
| sudo ip link set netns NorthNS dev vethNorth | |
| sudo ip link set netns SouthNS dev vethSouth | |
| # Configure the namespaces network so they can reach each other |
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
| #!/bin/bash | |
| # Go to the kubernetes repo | |
| cd $GOROOT/src/k8s.io/kubernetes | |
| # Obtain all k8s releases | |
| git log --tags --simplify-by-decoration --pretty="format:%ai %d" | grep -E 'v1.\d+.0\)' > git.k8s.releases | |
| # Obtain all commits with ipv6 in its commit | |
| git log --pretty=format:"%ci %s" --all | grep -i ipv6 | cut -d- -f1,2 | uniq -c > git.ipv6.txt | |
| # Plot it | |
| gnuplot -p << EOF | |
| set title "Kubernetes IPv6 commits per month" |
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
| from kubernetes import client, config | |
| import sys | |
| # Obtain the namespace, the service name and the lb ip as the arguments | |
| if len(sys.argv) != 4: | |
| print ("Usage: lb.py namespace service_name ip") | |
| sys.exit(1) | |
| ns = sys.argv[1] | |
| name = sys.argv[2] |
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" | |
| "net" | |
| "time" | |
| ) | |
| func main() { | |
| fmt.Println(CreateListener("", "0.0.0.0:9999")) |