Skip to content

Instantly share code, notes, and snippets.

View govindkailas's full-sized avatar

Govind govindkailas

View GitHub Profile
@govindkailas
govindkailas / script.sh
Created January 2, 2023 16:19 — forked from cubedtear/script.sh
Self-updating bash script
#!/usr/bin/env bash
VERSION="0.0.2"
SCRIPT_URL='https://gist.github.com/cubedtear/54434fc66439fc4e04e28bd658189701/raw'
SCRIPT_DESCRIPTION=""
SCRIPT_LOCATION="${BASH_SOURCE[@]}"
rm -f updater.sh
function update()
{
@govindkailas
govindkailas / CAPD_Cluster
Last active March 8, 2024 08:13
Deploying a CAPD cluster
# An attempt to create a CAPD cluster as explained in https://cluster-api.sigs.k8s.io/user/quick-start.html
# config.yaml for kind cluster which maps host docker socket into the kind cluster node
cat >config.yaml <<EOF
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
extraMounts:
- hostPath: /var/run/docker.sock
@govindkailas
govindkailas / get_k8s_resource_yaml
Last active July 29, 2021 11:14
Get the yaml for the deployed kubernetes object/resource with out all the unwanted fields.
#yq is a pre-req
kubectl get deploy -o yaml |yq eval 'del(.metadata.resourceVersion, .metadata.uid, .metadata.annotations, .metadata.creationTimestamp, .metadata.selfLink, .metadata.managedFields, .status)' -
#if you want a more simple solution just add an alias like below to your .bashrc/.profile,
alias clean-yaml='yq eval "del(.metadata.resourceVersion, .metadata.uid, .metadata.annotations, .metadata.creationTimestamp, .metadata.selfLink, .metadata.managedFields, .status)" - '
kubectl get sts redis -o yaml | clean-yaml
@govindkailas
govindkailas / nginx-pvc.yaml
Last active July 28, 2021 17:41
Nginx deployment with dynamic pvc, init container and ingress
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-vol-nginx
namespace: gkr-dev #change this accordigly
annotations:
volume.beta.kubernetes.io/storage-class: default
spec:
accessModes:
- ReadWriteMany
@govindkailas
govindkailas / get_image_manifest.sh
Created April 1, 2021 14:17 — forked from alex-bender/get_image_manifest.sh
Docker Registry v2 get manifest and push\pull
#!/bin/bash
#
# Shell scripts for get image manifest from v2 registry
#
# Tested on Debian 8, curl 7.38.0, jq-1.5
#
set -e -u
# Default tag is latest
@govindkailas
govindkailas / kubernetes_add_service_account_kubeconfig.sh
Last active October 25, 2019 12:48 — forked from innovia/kubernetes_add_service_account_kubeconfig.sh
Create a service account and generate a kubeconfig file for it - this will also set the default namespace for the user
#!/bin/bash
set -e
set -o pipefail
# Add user to k8s using service account, no RBAC (must create RBAC after this script)
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
echo "usage: $0 <service_account_name> <namespace>"
exit 1
fi