Skip to content

Instantly share code, notes, and snippets.

View cxhercules's full-sized avatar
🏠
Working from home

Christian Hercules cxhercules

🏠
Working from home
  • cxh
  • CA
View GitHub Profile
(curl ifconfig.me).content
$Path = $env:TEMP; $Installer = "chrome_installer.exe"; Invoke-WebRequest "https://dl.google.com/chrome/install/latest/chrome_installer.exe" -OutFile $Path$Installer; Start-Process -FilePath $Path$Installer -Args "/silent /install" -Verb RunAs -Wait; Remove-Item $Path$Installer
@cxhercules
cxhercules / helm-value-trick.md
Last active June 18, 2019 17:17
Processing helm variables in values file

You need to use a tpl trick to interpolate the value, since helm variable in values are not processed, you have to update your deployment, for example:

In your values.yaml:

  tag: "{{ .Chart.AppVersion }}"

In your deployment:

 image: "{{ .Values.api.image.repository }}:{{ tpl .Values.api.image.tag . }}"
@cxhercules
cxhercules / awk-system.sh
Created February 12, 2019 22:50
awk run system command against field
#!/bin/bash
cat secrets-alone.yml |awk -F: '{ printf "export %s=",$1; system ("echo "$2"|base64 -d "); system("echo")}'
# Drain and delete the nodes (for each node you have)
kubectl drain kubenode1 --delete-local-data --force --ignore-daemonsets
kubectl delete node kubenode1
# Reset the deployment
sudo kubeadm reset
# On each node
## Reset the nodes and weave
openssl x509 -in /etc/kubernetes/pki/ca.crt -noout -pubkey | openssl rsa -pubin -outform DER 2>/dev/null | sha256sum | cut -d' ' -f1
Reference:
https://github.com/kubernetes/kubeadm/issues/659#issuecomment-392822587
@cxhercules
cxhercules / k8s-user-data.sh
Created December 27, 2018 06:04 — forked from MeenachiSundaram/k8s-user-data.sh
kubernetes user data script
#!/bin/bash
apt-get update
apt-get install -y git wget
# Install Docker
apt-get install \
apt-transport-https \
ca-certificates \
curl \

Read from vault without saving secret value

vault read -field=value "secret/gcp-creds/${SERVICE_ACCOUNT_PROJECT_ID}/${SERVICE_ACCOUNT_NAME}.json" \
  | gcloud auth activate-service-account "${SERVICE_ACCOUNT_EMAIL}" --key-file -
VBoxManage controlvm minikube natpf1 k8s-apiserver,tcp,127.0.0.1,8443,,8443
kubectl config set-cluster minikube-vpn --server=https://127.0.0.1:8443 --insecure-skip-tls-verify
kubectl config set-context minikube-vpn --cluster=minikube-vpn --user=minikube
kubectl config use-context minikube-vpn
VBoxManage controlvm minikube natpf1 k8s-dashboard,tcp,127.0.0.1,30000,,30000
VBoxManage controlvm minikube natpf1 docker,tcp,127.0.0.1,2376,,2376
minikube docker-env|sed 's/192.168.99.101/127.0.0.1/'
@cxhercules
cxhercules / pem-split
Created August 23, 2018 15:34 — forked from jinnko/pem-split
Take a PEM format file as input and split out certs and keys into separate files.
#!/usr/bin/awk -f
#
# Take a PEM format file as input and split out certs and keys into separate files
#
BEGIN { n=0; cert=0; key=0; if ( ARGC < 2 ) { print "Usage: pem-split FILENAME"; exit 1 } }
/-----BEGIN PRIVATE KEY-----/ { key=1; cert=0 }
/-----BEGIN CERTIFICATE-----/ { cert=1; key=0 }
split_after == 1 { n++; split_after=0 }
/-----END CERTIFICATE-----/ { split_after=1 }