Skip to content

Instantly share code, notes, and snippets.

multipass launch --name rancher --cpus 2 --mem 4G --disk 10G
multipass exec rancher -- bash -c 'curl https://releases.rancher.com/install-docker/19.03.sh | sh'
multipass exec rancher -- sudo usermod -aG docker ubuntu
multipass shell rancher
docker volume create --name rancher-var-lib --driver local
docker run -d --rm -p 80:80 -p 443:443 -v rancher-var-lib:/var/lib/rancher/ rancher/rancher:stable
exit
$ multipass ls
Name State IPv4 Image
rancher Running 192.168.64.45 Ubuntu 18.04 LTS
FROM openjdk:8-alpine
# Configuration variables.
ENV JIRA_HOME /var/atlassian/jira
ENV JIRA_INSTALL /opt/atlassian/jira
ENV JIRA_VERSION 7.11.2
RUN addgroup -S jira
RUN adduser -S jira -G jira
cluster_name: infra-rancher-cluster
ignore_docker_version: true
ssh_key_path: ~/.ssh/id_rsa
network:
plugin: flannel
system_images:
kubernetes: rancher/hyperkube:v1.13.5-rancher1
nodes:
- address: csky05
internal_address: <redacted>

I've been working with Kafka for over 7 years. I inevitably find myself doing the same set of activities while I'm developing or working with someone else's system. Here's a set of Kafka productivity hacks for doing a few things way faster than you're probably doing them now. 🔥

Get the tools

#!/bin/bash
set -euo pipefail
echo -e "Iterating...\n"
nodes=$(kubectl get node --no-headers -o custom-columns=NAME:.metadata.name)
for node in $nodes; do
echo "Node: $node"
kubectl describe node "$node" | sed '1,/Non-terminated Pods/d'
alias util='kubectl get nodes --no-headers | awk '\''{print $1}'\'' | xargs -I {} sh -c '\''echo {} ; kubectl describe node {} | grep Allocated -A 5 | grep -ve Event -ve Allocated -ve percent -ve -- ; echo '\'''
util
Q: Is it possible to create a custom role, where a non-admin user which has only view rights to run “oc rsh” command to only a certain pod or in a project to all pods?
A: you can define a custom role which allows only rsh permission (pods/exec):
create a yaml file like this: my-custom-role.yaml
```
apiVersion: authorization.openshift.io/v1
kind: ClusterRole
metadata:
name: rsh-pod
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
run: utils
name: utils
spec:
replicas: 1
selector:
matchLabels:
apiVersion: v1
kind: Service
metadata:
name: kafka-topics
namespace: aceme-confluent-dev # change it
labels:
app.kubernetes.io/component: kafka-topics
spec:
ports:
- port: 8082
export TF_VAR_rancher_access_key=token-xyz123
export TF_VAR_rancher_secret_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
export TF_VAR_AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxxxx
export TF_VAR_AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxx
export TF_VAR_AWS_DEFAULT_REGION=eu-central-1
export AWS_DEFAULT_REGION=eu-central-1
export AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
export AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx