Skip to content

Instantly share code, notes, and snippets.

View Hardeep18's full-sized avatar
🚀
Focusing

Hardeep Hardeep18

🚀
Focusing
View GitHub Profile
@Hardeep18
Hardeep18 / 10-kubeadm.conf
Created October 3, 2018 17:09 — forked from dims/10-kubeadm.conf
experiment - kubeadm with cloud controller manager
[Service]
Environment="KUBELET_KUBECONFIG_ARGS=--v=99 --enable-controller-attach-detach=true --cloud-provider=external --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
Environment="KUBELET_SYSTEM_PODS_ARGS=--pod-manifest-path=/etc/kubernetes/manifests --allow-privileged=true"
Environment="KUBELET_NETWORK_ARGS=--network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin"
Environment="KUBELET_DNS_ARGS=--cluster-dns=10.96.0.10 --cluster-domain=cluster.local"
Environment="KUBELET_AUTHZ_ARGS=--authorization-mode=Webhook --client-ca-file=/etc/kubernetes/pki/ca.crt"
Environment="KUBELET_CADVISOR_ARGS=--cadvisor-port=0"
Environment="KUBELET_CERTIFICATE_ARGS=--rotate-certificates=true --cert-dir=/var/lib/kubelet/pki"
ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_SYSTEM_PODS_ARGS $KUBELET_NETWORK_ARGS $KUBELET_DNS_ARGS $KUBELET_AUTHZ_ARGS $KUBELET_CADVISOR_ARGS $KUBELET_CERTIFICATE_ARGS $KUBELET_EXTRA_ARGS
@Hardeep18
Hardeep18 / kubectl-commands.md
Created October 11, 2018 11:08 — forked from DStorck/kubectl-commands.md
kubectl commands

filter kubernetes response with kubectl

make file with all results , then filter into new file

kubectl get nodes > all_nodes.txt

cat all_nodes.txt | while read line ; do if [[ $line == *"sobusy"* ]]; then echo $line; fi; done > filtered_nodes.txt

filter results by search criteria

kubectl logs <pod> <search_criteria> > some_file.txt

@Hardeep18
Hardeep18 / logstash.conf
Created October 18, 2018 06:39 — forked from mrlesmithjr/logstash.conf
Logstash Configuration File
input {
redis {
host => "127.0.0.1"
data_type => "list"
key => "logstash"
}
}
input {
udp {
type => "syslog"
@Hardeep18
Hardeep18 / delete-evicted-pods-all-namespaces.sh
Created November 15, 2018 02:49 — forked from psxvoid/delete-evicted-pods-all-namespaces.sh
Delete evicted pods from all namespaces (also ImagePullBackOff and ErrImagePull)
#!/bin/sh
# based on https://gist.github.com/ipedrazas/9c622404fb41f2343a0db85b3821275d
# delete all evicted pods from all namespaces
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
# delete all containers in ImagePullBackOff state from all namespaces
kubectl get pods --all-namespaces | grep 'ImagePullBackOff' | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
# delete all containers in ImagePullBackOff or ErrImagePull or Evicted state from all namespaces
@Hardeep18
Hardeep18 / cleanupManifestsWithoutTags.sh
Created January 1, 2019 16:43 — forked from mortensteenrasmussen/cleanupManifestsWithoutTags.sh
Clean up untagged manifests in private docker registry
#!/bin/bash
REGISTRY_DIR=YOUR_REGISTRY_DIR/data/docker/registry/v2/repositories
REGISTRY_URL=http://10.10.10.10:5000
#add --insecure to the curl command on line 17 if you use https with self-signed certificates
cd ${REGISTRY_DIR}
count=0
manifests_without_tags=$(comm -23 <(find . -type f -name "link" | grep "_manifests/revisions/sha256" | grep -v "\/signatures\/sha256\/" | awk -F/ '{print $(NF-1)}' | sort) <(for f in $(find . -type f -name "link" | grep "_manifests/tags/.*/current/link"); do cat ${f} | sed 's/^sha256://g'; echo; done | sort))
@Hardeep18
Hardeep18 / docker-registry.sh
Created January 1, 2019 16:44 — forked from itatabitovski/docker-registry.sh
List and delete tags and repositories from v2 docker registry
#!/bin/bash
set -euo pipefail
CMD=$0
function usage {
cat <<EOU
Usage:
#!/bin/bash
JQPATH=$(which jq)
if [ "x$JQPATH" == "x" ]; then
echo "Couldn't find jq executable." 1>&2
exit 2
fi
set -eu
shopt -s nullglob
@Hardeep18
Hardeep18 / bible.py
Created January 8, 2019 17:11 — forked from Karunamon/bible.py
Bible verse cog for Red-Discordbot
import discord
import requests
import json
import urllib
from discord.ext import commands
class Bible:
def __init__(self, bot):
@Hardeep18
Hardeep18 / letsencrypt_2018.md
Created January 8, 2019 18:45 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

#!/bin/bash
# Copyright 2015 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#