Skip to content

Instantly share code, notes, and snippets.

View hossainemruz's full-sized avatar

Emruz Hossain hossainemruz

View GitHub Profile
@hossainemruz
hossainemruz / ExecOnPod
Created April 2, 2018 07:39
cient-go execute command on pod
package main
import (
"bytes"
"flag"
"fmt"
"log"
"github.com/appscode/go/crypto/rand"
"github.com/appscode/go/types"

Here is log from elasticsearch node.

+ /fsloader/run_sgadmin.sh
chown: /elasticsearch/plugins/search-guard-6/sgconfig/..data: Read-only file system
chown: /elasticsearch/plugins/search-guard-6/sgconfig/sg_roles.yml: Read-only file system
chown: /elasticsearch/plugins/search-guard-6/sgconfig/sg_internal_users.yml: Read-only file system
chown: /elasticsearch/plugins/search-guard-6/sgconfig/sg_config.yml: Read-only file system
chown: /elasticsearch/plugins/search-guard-6/sgconfig/sg_action_groups.yml: Read-only file system
chown: /elasticsearch/plugins/search-guard-6/sgconfig/READALL_PASSWORD: Read-only file system
chown: /elasticsearch/plugins/search-guard-6/sgconfig/ADMIN_PASSWORD: Read-only file system
cluster:
name: es-monitoring-cluster
node:
master: true
data: true
name: es-monitoring-cluster-0
ingest: true
network.host: 0.0.0.0
kubectl logs -n demo es-auth-none2-0 -f
+ set -o errexit
+ set -o pipefail
+ sync
+ CUSTOM_CONFIG_DIR=/elasticsearch/custom-config
+ '[' -d /elasticsearch/custom-config ']'
+ echo 'Starting runit...'
+ exec /sbin/runsvdir -P /etc/service
+ set -o errexit
@hossainemruz
hossainemruz / mysql-init-demo.yaml
Created October 30, 2018 16:57
Sample MySQL deployment to initialize from *.sql file
# Here, I am using a gcePersistentDisk disk to store my init.sql file.
# You can you any Kubernetes volume such as hostPath,nfs etc.
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql-init-demo
spec:
selector:
matchLabels:
app: mysql
@hossainemruz
hossainemruz / mysql-initialization-with-init-container.yaml
Created November 2, 2018 05:56
This sample show how to use init container to download init.sql file and initialize mysql database using this file
# this pvc will be used to store downloaded init.sql file
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: init-script
spec:
accessModes:
- ReadWriteOnce
volumeMode: Filesystem
resources:
@hossainemruz
hossainemruz / kube-dns.yaml
Created November 8, 2018 08:11
YAML config file for kube-dns with upstreamNameserver
apiVersion: v1
kind: ConfigMap
metadata:
name: kube-dns
namespace: kube-system
data:
upstreamNameservers: |
["8.8.8.8", "8.8.4.4"]
#!/bin/bash
DB_NAME="database_name"
DB_USER="username"
DB_PASS="password"
DB_HOST="localhost"
DB_PORT="3306"
while ! nc -q 1 $DB_HOST $DB_PORT </dev/null; do
echo "Waiting for database to be ready....."
sleep 5
version: "2"
services:
universe:
build: .
working_dir: /usr/src
environment:
- NODE_ENV=default
- PORT=3000
volumes:
- /usr/src
<!DOCTYPE html>
<html>

<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
</head>

<body>