Skip to content

Instantly share code, notes, and snippets.

View keshavab's full-sized avatar

Keshava keshavab

  • Bangalore
  • 14:35 (UTC +05:30)
View GitHub Profile
def get_devices(device_dir, logger):
devices = []
for line in open('/proc/mounts').readlines():
data = line.strip().split()
block_device = data[0]
mount_point = data[1]
if mount_point.startswith(device_dir):
device = {}
device['mount_point'] = mount_point
device['block_device'] = block_device
@keshavab
keshavab / kubernetes errors
Last active August 29, 2015 14:24
kubernetes errors
[vagrant@kubernetes-master ~]$ kubectl cluster-info
error: couldn't read version from server: Get http://localhost:8080/api: dial tcp 127.0.0.1:8080: connection refused
[root@kubernetes-master vagrant]# systemctl status kubelet
● kubelet.service - Kubernetes Kubelet Server
Loaded: loaded (/usr/lib/systemd/system/kubelet.service; disabled)
Active: inactive (dead)
Docs: https://github.com/GoogleCloudPlatform/kubernetes
Can start the kubelet service -
@keshavab
keshavab / gist:86abd43dcb290ab8751b
Last active August 29, 2015 14:24
kubernete-coreos vagrant hang
KEHP-M-X03J:kubernetes-vagrant-coreos-cluster keshava$ vagrant up
Bringing machine 'master' up with 'virtualbox' provider...
Bringing machine 'node-01' up with 'virtualbox' provider...
Bringing machine 'node-02' up with 'virtualbox' provider...
==> master: Running triggers before up...
==> master: Setting Kubernetes version 0.21.0
==> master: Configuring Kubernetes cluster DNS...
==> master: Box 'coreos-alpha' could not be found. Attempting to find and install...
master: Box Provider: virtualbox
master: Box Version: >= 738.1.0
@keshavab
keshavab / gist:7d33d6e39e8ed8a7381b
Created July 10, 2015 04:55
kubernetes-vagrant error
Wrote config for vagrant to /Users/keshava/.kube/config
Each machine instance has been created/updated.
Now waiting for the Salt provisioning process to complete on each machine.
This can take some time based on your network, disk, and cpu speed.
It is possible for an error to occur during Salt provision of cluster and this could loop forever.
Validating master
Validating minion-1
.............
Waiting for each minion to be registered with cloud provider
error: couldn't read version from server: Get https://10.245.1.2/api: dial tcp 10.245.1.2:443: connection refused
@keshavab
keshavab / gist:0f84278f1c4eaf84d220
Created August 4, 2015 15:37
kubernetes - centos make error
make
hack/build-go.sh
+++ [0804 10:48:32] Building go targets for linux/amd64:
cmd/kube-proxy
cmd/kube-apiserver
cmd/kube-controller-manager
cmd/kubelet
cmd/hyperkube
cmd/kubernetes
cmd/linkcheck
@keshavab
keshavab / gist:816a9af0a55cca658f01
Created August 6, 2015 10:16
running selective tags on roles
to be able to include a role and be able to pass the tagged tasks to run or to skip. For example:
roles:
- { role: myrole, run_tags: service_restart skip_tags: datastore }
- { role: anotherrole, run_tags: install_configs,service_restart }
- { role: finalrole, skip_tags: service_restart }
n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/local
@keshavab
keshavab / html-partial
Created March 15, 2016 02:45
html-partial
<!DOCTYPE html>
<html lang="{{ with .Site.LanguageCode }}{{ . }}{{ else }}en-US{{ end }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="{{ with .Site.Params.name }}{{ . }}{{ end }}">
<meta name="description" content="{{ with .Site.Params.description }}{{ . }}{{ end }}">
{{ .Hugo.Generator }}
<title>{{ .Title }} &middot; {{ .Site.Title }}</title>
@keshavab
keshavab / wercker.yml
Created March 15, 2016 05:39
wercker for automated github pages deployment
box: debian
build:
steps:
- script:
name: install git
code: |
apt-get update
apt-get install git -y
- script:
name: fetch theme sub module
@keshavab
keshavab / anonfuncs.go
Last active March 31, 2016 10:15
anonymous function
package main
import "fmt"
func printMessage(message string) {
fmt.Println(message)
}
func getPrintMessage() func(string) {
// returns an anonymous function