Skip to content

Instantly share code, notes, and snippets.

View MeirP-3's full-sized avatar

Meir Pechthalt MeirP-3

View GitHub Profile
@MeirP-3
MeirP-3 / cluster.yaml
Created June 8, 2022 14:40
cluster.yaml
apiVersion: kops.k8s.io/v1alpha2
kind: Cluster
metadata:
name: example.com
spec:
DisableSubnetTags: true
additionalPolicies:
master: |
[
{
@MeirP-3
MeirP-3 / client-go-get-pod
Created May 14, 2022 19:44
A demonstration of get pod with client-go
/*
A demonstration of get pod using client-go
Based on client-go examples: https://github.com/kubernetes/client-go/tree/master/examples
To demonstrate, run this file with `go run <filename> --help` to see usage
*/
package main
import (
"context"
@MeirP-3
MeirP-3 / container.log
Created April 7, 2022 09:18
Container log
[41 ms] Remote-Containers 0.231.4 in VS Code 1.66.0 (e18005f0f1b33c29e81d732535d8c0e47cafb0b5).
[40 ms] Start: Resolving Remote
[47 ms] Start: Run: kubectl exec -it my-dev-pod-86974569bc-f8l6g --context example --namespace example --container my-dev-pod -- /bin/sh -c VSCODE_REMOTE_CONTAINERS_SESSION='d9c76cba-f81e-488e-97ca-9e6ce5b543a21649321391744' /bin/sh
[52 ms] Start: Run in container: echo $PATH
[2348 ms] /go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[2349 ms] Unable to use a TTY - input is not a terminal or the right kind of file
[2349 ms] Start: Run in container: id -un
[2495 ms] root
[2495 ms]
[2496 ms] Start: Run in container: uname -m
@MeirP-3
MeirP-3 / vscode-python-files.watcherExclude-and-files.exclude-settings.md
Created November 22, 2020 13:59
vscode python settings to solve `unable to watch for file changes in this large workspace` and hide auto generated files
  1. add the following settings to your project's folder under .vscode/settings.json:

If no such directory/file, create them

{
  "files.watcherExclude": {
    "**/.git/objects/**": true,
    "**/.git/subtree-cache/**": true,
    "**/node_modules/**": true,
    "**/.hg/store/**": true,
 "**/.eggs/**": true,
I1104 16:57:43.769358 23718 featureflag.go:154] FeatureFlag "Spotinst"=true
I1104 16:57:43.809652 23718 loader.go:375] Config loaded from file: /home/meirp/.kube/config
Using cluster from kubectl context: example.com
I1104 16:57:43.809717 23718 factory.go:68] state store s3://some-bucket/kops
I1104 16:57:43.809758 23718 s3context.go:328] unable to read /sys/devices/virtual/dmi/id/product_uuid, assuming not running on EC2: open /sys/devices/virtual/dmi/id/product_uuid: permission denied
I1104 16:57:45.261492 23718 s3context.go:163] unable to get region from metadata:unable to get region from metadata: EC2MetadataRequestError: failed to get EC2 instance identity document
caused by: RequestError: send request failed
caused by: Get http://169.254.169.254/latest/dynamic/instance-identity/document: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
I1104 16:57:45.261576 23718 s3context.go:173] defaulting region to "us-east-1"
@MeirP-3
MeirP-3 / gist:f91ca9d5f382ecff1c2c327c9f4ddf01
Last active November 4, 2020 15:13
log of rolling update --yes
This file has been truncated, but you can view the full file.
I1104 15:54:48.294095 12586 featureflag.go:154] FeatureFlag "Spotinst"=true
I1104 15:54:48.343142 12586 loader.go:375] Config loaded from file: /home/meirp/.kube/config
Using cluster from kubectl context: example.com
I1104 15:54:48.343211 12586 factory.go:68] state store s3://example-dev-state/kops
I1104 15:54:48.343248 12586 s3context.go:328] unable to read /sys/devices/virtual/dmi/id/product_uuid, assuming not running on EC2: open /sys/devices/virtual/dmi/id/product_uuid: permission denied
I1104 15:54:49.913351 12586 s3context.go:163] unable to get region from metadata:unable to get region from metadata: EC2MetadataRequestError: failed to get EC2 instance identity document
caused by: RequestError: send request failed
caused by: Get http://169.254.169.254/latest/dynamic/instance-identity/document: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
I1104 15:54:49.913409 12586 s3context.go:173] defaulting region to "us-east-1"
I1104 15:53:42.480826 12397 featureflag.go:154] FeatureFlag "Spotinst"=true
I1104 15:53:42.523945 12397 loader.go:375] Config loaded from file: /home/meirp/.kube/config
Using cluster from kubectl context: test.example.com
I1104 15:53:42.524109 12397 factory.go:68] state store s3://some-bucket/kops
I1104 15:53:42.524169 12397 s3context.go:328] unable to read /sys/devices/virtual/dmi/id/product_uuid, assuming not running on EC2: open /sys/devices/virtual/dmi/id/product_uuid: permission denied
I1104 15:53:43.947423 12397 s3context.go:163] unable to get region from metadata:unable to get region from metadata: EC2MetadataRequestError: failed to get EC2 instance identity document
caused by: RequestError: send request failed
caused by: Get http://169.254.169.254/latest/dynamic/instance-identity/document: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
I1104 15:53:43.947489 12397 s3context.go:173] defaulting region to "us-east-1"
@MeirP-3
MeirP-3 / cluster-spec.yaml
Created November 4, 2020 12:33
cluster spec for #10166
apiVersion: kops.k8s.io/v1alpha2
kind: Cluster
metadata:
name: example.cluster.com
spec:
additionalPolicies:
master: |
[
{
"Effect": "Allow",
@MeirP-3
MeirP-3 / gist:0e0624ac26db9d3988ba07493fa22604
Created October 12, 2020 11:32
/etc/kubernetes/manifests/kube-apiserver.manifest
$ cat /etc/kubernetes/manifests/kube-apiserver.manifest
apiVersion: v1
kind: Pod
metadata:
annotations:
dns.alpha.kubernetes.io/internal: api.internal.dev.nvsrc.com
scheduler.alpha.kubernetes.io/critical-pod: ""
creationTimestamp: null
labels:
k8s-app: kube-apiserver
@MeirP-3
MeirP-3 / cluster-ig.yaml
Created October 11, 2020 17:39
cluster
apiVersion: kops.k8s.io/v1alpha2
kind: Cluster
metadata:
creationTimestamp: null
generation: 1
name: example.com
spec:
additionalPolicies:
master: |
[