Skip to content

Instantly share code, notes, and snippets.

View initcron's full-sized avatar

Gourav Shah initcron

View GitHub Profile
@initcron
initcron / user-data.sh
Last active December 22, 2022 07:07
Kubernetes User Data 2022
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y git wget net-tools
# Prereqs
modprobe overlay
@initcron
initcron / wsl2-connect.md
Created June 17, 2022 03:31
Connecting to Docker Desktop Host with WSL2
C:\Users\xyz> wsl -l

[sample output] Windows Subsystem for Linux Distributions: docker-desktop-data (Default) docker-desktop Ubuntu

@initcron
initcron / Dockerfile
Last active August 17, 2022 16:27
Multistage for Facebooc
FROM alpine AS build
WORKDIR /opt/facebooc
COPY . .
RUN apk add --update alpine-sdk sqlite-dev sqlite && \
make all
FROM alpine AS run
WORKDIR /opt/facebooc
COPY --from=build /opt/facebooc/bin .
export kubever=$(kubectl version | base64 | tr -d '\n')
kubectl delete -f "https://cloud.weave.works/k8s/net?k8s-version=$kubever"
kubectl create -f https://docs.projectcalico.org/manifests/tigera-operator.yaml
kubectl create -f https://docs.projectcalico.org/manifests/custom-resources.yaml
@initcron
initcron / k8s-delete-pending-namespace.sh
Created April 25, 2021 09:21
Delete a namespace which is pending termination due to a finalizer.
export PENDING_NAMESPACE=xxxxxx
kubectl get namespace $PENDING_NAMESPACE -o json | tr -d "\n" | sed "s/\"finalizers\": \[[^]]\+\]/\"finalizers\": []/" | kubectl replace --raw /api/v1/namespaces/$PENDING_NAMESPACE/finalize -f -
@initcron
initcron / sample_jenkins_pipeline.Jenkinsfile
Created December 21, 2020 03:45
Sample Jenkins Pipeline
pipeline {
agent any
stages{
stage("one"){
steps{
echo 'step 1'
sleep 3
}
}
stage("two"){

Nano Project : Dockerize a Facebook Clone

As a devops engineer, you are asked to write a Dockerfile to automate image build for deploying Facebooc, a Facebook clone written in C language. It uses SQLite as a database backend to store user logins and posts.

Source Repo: https://github.com/schoolofdevops/facebooc.git

Steps to install/setup Facebooc:

Use ubuntu as a base image/platform

Error

Linux kube-01 4.4.0-142-generic #168-Ubuntu SMP Wed Jan 16 21:00:45 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

root@kube-01:/home/vagrant# kubeadm init --apiserver-advertise-address 192.168.56.101 --pod-network-cidr=192.168.0.0/16

[init] Using Kubernetes version: v1.13.4

[preflight] Running pre-flight checks
@initcron
initcron / screen-stuff.md
Created October 4, 2018 04:54 — forked from gesellix/screen-stuff.md
screen and Docker for Mac

screen ~/Library/Containers//com.docker.docker/Data/vms/0/tty


screen -AmdS docker ~/Library/Containers//com.docker.docker/Data/vms/0/tty
screen -r docker
# enter, then disconnect with Ctrl-a d
screen -S docker -p 0 -X stuff $(printf root\\r\\n)
screen -r docker