Skip to content

Instantly share code, notes, and snippets.

@nicolaihald
nicolaihald / kubectl-multi-version-brews.md
Created December 7, 2020 05:50 — forked from rdump/kubectl-multi-version-brews.md
kubectl multi-version brews (kubernetes-cli formula)

kubectl multi-version brews

We need to run multiple versions of kubectl for compatibility with various kubernetes clusters.

It's a bit easier to get and use multiple versions of kubectl using Homebrew than it is using Macports.

With brew, it's simple to:

  • Install a bunch of versions of kubectl (in the kubernetes-cli Formula)
  • Switch between them as needed
@nicolaihald
nicolaihald / docker-entrypoint.sh
Created February 12, 2018 12:40
default-docker-entrypoint.sh
#!/bin/bash
echo "Keep container running (infinite loop) - to be replaced by an actual entrypoint script!"
cleanup ()
{
kill -s SIGTERM $!
exit 0
}
@nicolaihald
nicolaihald / kubectl-commands.sh
Last active November 14, 2017 21:46
kubectl commands
# Copy secrets between two namespaces (from "default" to the "monitoring" namespace):
kubectl get secrets -o json --namespace default | jq '.items[].metadata.namespace = "monitoring"' | kubectl create -f -
# Copy a specific secret (fx. a docker-registry secret used for pulling images from a private registry):
kubectl get secret dockercfg -o json --namespace default | jq '.metadata.namespace = "monitoring"' | kubectl create -f -
@nicolaihald
nicolaihald / curl_for_http_statuscode.sh
Created May 3, 2017 06:57
Get HTTP status code with curl AND print response on new line
while true; do curl -s -o /dev/null -w "%{http_code}\n" http://localhost; sleep 2; done
@nicolaihald
nicolaihald / v1-ubuntu-docker-node-apt-get.sh
Created April 11, 2017 10:46 — forked from garystafford/v1-ubuntu-docker-node-apt-get.sh
Install the latest versions of Node.js and npm into a Docker Ubuntu container, with or without need for root access. Easily update both applications to the latest versions. Creates a new user account ('testuser') and installs common npm packages.
###############################################################################
# Version 1: using ‘apt-get install’
# Installs using apt-get
# Requires update to npm afterwards
# Harder to get latest copy of node
# Requires sudo to use npm
###############################################################################
# create new docker ubuntu container
sudo docker run -i -t ubuntu /bin/bash # drops you into container as root
@nicolaihald
nicolaihald / Dockerfile
Created March 16, 2017 20:50
maven-ci-build
maven-ci-build
# Ubuntu 14.04 LTS
# Oracle Java 1.8.0_11 64 bit
# Maven 3.0.5-1
# Jenkins 1.643
# Nano 2.2.6-1ubuntu1
FROM ubuntu:14.04.5
# setup proxy variables
@nicolaihald
nicolaihald / userdata
Created December 15, 2016 21:26
EC2 user data script to boostrap Windows instance with Python and AWS CLI
<powershell>
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
choco install python -y
(new-object net.webclient).DownloadFile('https://s3.amazonaws.com/aws-cli/AWSCLI64.msi','c:\AWSCLI64.msi')
msiexec.exe /i 'C:\AWSCLI64.msi' /qn
</powershell>
@nicolaihald
nicolaihald / userdata.sh
Created December 15, 2016 21:24
AWS - Userdata script to setup a basic web page with instance id and tag instance
#!/bin/bash
yum install httpd -y
/sbin/chkconfig --levels 235 httpd on
service httpd start
instanceId=$(curl http://169.254.169.254/latest/meta-data/instance-id)
region=$(curl http://169.254.169.254/latest/dynamic/instance-identity/document | grep region | awk -F\" '{print $4}')
echo "<h1>$instanceId</h1>" > /var/www/html/index.html
aws ec2 create-tags --resources "$instanceId" --tags Key=Name,Value="WEB-ASG-NODE-$instanceId" --region "$region"
@nicolaihald
nicolaihald / logstash.searchlogger.conf
Last active June 10, 2016 13:44
logstash.searchlogger.conf
input {
redis {
host => "10.78.35.102"
data_type => "list"
key => "filebeat"
codec => json {
charset => "CP1252"
}
}
}
@nicolaihald
nicolaihald / solrconfig.xml
Created June 8, 2016 13:15
solrconfig.xml
<?xml version="1.0" encoding="utf-8" ?>
<SearchConfiguration
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays"
xmlns="http://schemas.datacontract.org/2004/07/Goo.Infrastructure.Solr">
<Books>
<!-- Dansk-Engelsk-->
<Book>