Skip to content

Instantly share code, notes, and snippets.

View naishe's full-sized avatar
🚀
Let's Launch This Thing!

Nishant Neeraj naishe

🚀
Let's Launch This Thing!
View GitHub Profile
@naishe
naishe / restore-rkestate-file.md
Created April 4, 2023 15:12 — forked from superseb/restore-rkestate-file.md
Recover cluster.rkestate file from controlplane node

Recover cluster.rkestate file from controlplane node

RKE

Run on controlplane node, uses any found hyperkube image

k8s 1.19 and higher

docker run --rm --net=host -v $(docker inspect kubelet --format '{{ range .Mounts }}{{ if eq .Destination "/etc/kubernetes" }}{{ .Source }}{{ end }}{{ end }}')/ssl:/etc/kubernetes/ssl:ro --entrypoint bash $(docker inspect $(docker images -q --filter=label=org.label-schema.vcs-url=https://github.com/rancher/hyperkube-base.git) --format='{{index .RepoTags 0}}' | tail -1) -c 'kubectl --kubeconfig /etc/kubernetes/ssl/kubecfg-kube-node.yaml -n kube-system get configmap full-cluster-state -o json | jq -r .data.\"full-cluster-state\" | jq -r .' > cluster.rkestate
@naishe
naishe / get-kube-admin-kubecfg-certs-from-cluster-rkestate.md
Created April 4, 2023 15:11 — forked from superseb/get-kube-admin-kubecfg-certs-from-cluster-rkestate.md
Get kube-admin kubeconfig and certificates from cluster.rkestate

Get kube-admin kubeconfig and certificates from cluster.rkestate

See how to retrieve cluster.rkestate from controlplane node here: https://gist.github.com/superseb/e9f2628d1033cb20e54f6ee268683a7a

Get kube-admin kubeconfig from cluster.rkestate

cat cluster.rkestate | jq -r '.currentState.certificatesBundle."kube-admin".config' > kube-admin-kubeconfig.yml
#!/bin/bash
# Run this on This AMI on AWS:
# https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#LaunchInstanceWizard:ami=ami-b36981d8
# You should get yourself a fully working GPU enabled tensorflow installation.
cd ~
# grab cuda 7.0
// phantomjs code to log in to Amazon
// based on the code from this Stackoverflow answer: http://stackoverflow.com/questions/9246438/how-to-submit-a-form-using-phantomjs
// I'm injecting jQuery so this assumes you have jquery in your project directory
var page = new WebPage(), testindex = 0, loadInProgress = false;
page.onConsoleMessage = function(msg) {
console.log(msg);
};
@naishe
naishe / blogpost.yaml
Last active January 12, 2016 02:09 — forked from tjake/blogpost.yaml
Cassandra Stress Test
### DML ###
# Keyspace Name
keyspace: stresscql
# The CQL for creating a keyspace (optional if it already exists)
keyspace_definition: |
CREATE KEYSPACE stresscql WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
# Table name