Skip to content

Instantly share code, notes, and snippets.

View vishnuhd's full-sized avatar
🎯
Focusing

Vishnu Hari Dadhich vishnuhd

🎯
Focusing
View GitHub Profile
@vishnuhd
vishnuhd / killmysqlprocess.md
Created September 6, 2019 09:50
How to kill a stuck MySql Process

To kill a stuck MySql Process

Find the ID :

# mysqladmin processlist -hmysql-service -uroot -proot_password

Kill the process :

@vishnuhd
vishnuhd / jenkinsk8shelm.md
Last active September 8, 2019 20:24
Deploy Jenkins to K8s using Helm
@vishnuhd
vishnuhd / KOPS-KubeCluster.md
Last active September 3, 2019 13:03
Managing kubernetes cluster with KOPS

Managing kubernetes cluster with KOPS

Prerequisite

  • kops
  • kubectl
  • awscli configured

Create the kops cluster

  • For cluster creating we need to add more env variables. NAME will be the name of the cluster, since we wont do DNS settings we will use gossip based DNS and for that cluster name needs to end with .k8s.local and before that you can put almost anything.
@vishnuhd
vishnuhd / readme.md
Created September 3, 2019 11:15
Create Jenkins pipeline using REST api and CURL
  • Get the config.xml from a pre-created job or create another one according to the need :
➜  curl -X GET http://localhost:8080/job/test-pipeline/config.xml -u admin:admin -o config.xml
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1599  100  1599    0     0  18518      0 --:--:-- --:--:-- --:--:-- 18593
  • Generate Crumb :
➜ CRUMB=$(curl -s 'http://localhost:8080/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,":",//crumb)' -u admin:admin)
@vishnuhd
vishnuhd / readme.md
Last active September 3, 2019 07:28
Controller | Custom Controller | Operator

Since CoreOS coined the term "Operator", their article is the authority on what they mean by that:

An Operator is an application-specific controller that extends the Kubernetes API to create, configure and manage instances of complex stateful applications on behalf of a Kubernetes user. It builds upon the basic Kubernetes resource and controller concepts, but also includes domain or application-specific knowledge to automate common tasks better managed by computers.

We use Operators because managing stateful applications, like databases, caches and monitoring systems, is a big challenge, especially at massive scale. These systems require human operational knowledge to correctly scale, upgrade and reconfigure while at the same time protecting against data loss and unavailability.

To paraphrase: All Operators use the controller pattern, but not all controllers are Operators. It's only an Operator if it's got: controller pattern + API extension + single-app focus.

TfJob is a good example of an Operator,

@vishnuhd
vishnuhd / mysql-client-k8s.md
Created August 22, 2019 13:21
mysql-client in Kubernetes to test your connection to mysql server

mysql-client in Kubernetes to test your connection to mysql server

kubectl run mysql-client --image=mysql:5.7 -it --rm --restart=Never -- /bin/bash

mysql -h mysql-service -uroot -proot_password -e 'SHOW databases;'

OR

mysql -h mysql-service -uroot -proot_password

@vishnuhd
vishnuhd / docker-desktop-k8s-local-image.md
Created August 22, 2019 13:17
Reference local images in Docker for Mac - Kubernetes

Reference local images in Docker for Mac - Kubernetes

To run a local baked docker image in docker for mac kubernetes set the imagePullPolicy to Never.

For example:

apiVersion: v1
kind: Pod
metadata:
 name: local-image-test
@vishnuhd
vishnuhd / jenkins-on-docker.md
Last active September 7, 2019 21:28
Quickly get a Jenkins server running locally on docker with persistent volume

Command :

docker run -d -v jenkins_home:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts

PS :

Docker should be installed on the host machine.

@vishnuhd
vishnuhd / localstorage-docker-desktop.md
Last active August 20, 2019 09:00
To create a persistent volume on local hard drive with docker-desktop

StorageClass

apiVersion: storage.k8s.io/v1beta1
kind: StorageClass
metadata:
  name: localstorage
provisioner: docker.io/hostpath
@vishnuhd
vishnuhd / setup-helm-tiller.md
Last active August 8, 2019 11:53
setup helm tiller

Install Helm using the Helm installation instructions.

  • Create an RBAC service account.
kubectl create serviceaccount tiller -n kube-system
  • Bind the cluster-admin role to the service account.
kubectl create clusterrolebinding tiller \
--clusterrole=cluster-admin \