Skip to content

Instantly share code, notes, and snippets.

@kayoch1n
kayoch1n / README.md
Last active February 21, 2026 03:54 — forked from mikamboo/README.md
Kubernetes : Create Service Account with permission for a specific namespace + Generate KUBECONFIG

Create KUBECONFIG limited to specific namespace

  • create_user_for_namespace.sh: Create $namespace-admin ServiceAccount with full access to specified namespace and get KUBECONFIG

Usage

./create-user-for-namespace YOUR_FANCY_NAMESPACE
@kayoch1n
kayoch1n / k8s-mysql-source-replica.yaml
Last active August 13, 2025 16:31
Deploy MySQL source and replica servers in k8s 在 k8s 集群中部署MySQL主从server
# applied under the namespace "ms"
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mysql
spec:
selector:
matchLabels:
app: mysql
serviceName: mysql
@kayoch1n
kayoch1n / getifaddrs_linux.c
Last active December 4, 2022 02:59
getifaddrs on *nix
// gcc getifaddrs_linux.c -o getifaddrs_linux
// ./getifaddrs_linux
// https://stackoverflow.com/a/12878352
#include <stdlib.h> //exit()
#include <stdio.h> //printf(),perror()
#include <string.h> //memset
#include <ifaddrs.h> //struct ifaddrs,getifaddrs()
#include <arpa/inet.h> //INET6_ADDRSTRLEN,inet_ntop()
#include <netinet/in.h> //sockaddr_in,sockaddr_in6
@kayoch1n
kayoch1n / nfs_client.sh
Last active November 23, 2022 09:32
init NFS server/client on ubuntu
#!/bin/sh
# https://ubuntu.com/server/docs/service-nfs
# client
# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/4/html/reference_guide/s2-nfs-client-config-options
sudo mount 172.16.0.7:/home/ubuntu/nfsroot /opt/172-16-0-7/ -o nfsvers=2
cat /proc/mounts | grep nfsroot
cat /opt/172-16-0-7/README.md
# sudo umount /opt/172-16-0-7/