Security
Adding SSH Key Login and Troubleshooting
· β˜• 6 min read
1. Steps to Add a Key 1.1 Generate an SSH Key on the Client There are two key formats: Old format, the private key begins with -----BEGIN RSA PRIVATE KEY----- 1 ssh-keygen -m PEM -t rsa -b 4096 -C "mail@chenshaowen.com" New format, the private key begins with -----BEGIN OPENSSH PRIVATE KEY----- 1 ssh-keygen -t rsa -b 4096 -C "mail@chenshaowen.

How to Add a New Access Entry Point to the Kubernetes Apiserver
· β˜• 2 min read
1. How to Access a Remote Cluster Locally During development, you often need to connect directly to a remote Kubernetes cluster. The usual approach is to copy /etc/kubernetes/admin.conf to your local ~/.kube/kubeconfig. But the kubeconfig’s server address is kubernetes.default.svc. So we need to configure a hosts entry: 1 1.1.1.1 kubernetes.default.svc If you need to switch between different clusters, you not only have to swap the kubeconfig but also modify hosts.

How to Configure NetworkPolicy for NodePort in Kubernetes
· β˜• 7 min read
1. Background As shown above, the business team needs to isolate the services in a namespace, forbidding access from workloads in the bar namespace while allowing users to reach the service through a Load Balancer (LB) via NodePort. It is easy to write a network policy: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 apiVersion: networking.

Run `rm -rf /` Under Kubernetes and You Can Just Run Away
· β˜• 4 min read
This document is mainly meant to demonstrate the dangers of Docker privileged mode, so please proceed with caution. Users without CLI access can copy the example YAML and directly create cluster workloads such as Pod, Job, and DaemonSet to carry out the operations. 1. Directly Deleting All Resources If you can log in to the machine, pack your things, and run the command:

How to Debug a Container on the Host and Operate the Host from Inside a Container
· β˜• 9 min read
1. A Strange Requirement My boss had a strange requirement: use a single kubeconfig file to fetch all kinds of host status information, such as the process list and process states. My first reaction was that he must not understand containers β€” how could anyone use them that way, and if you were going to use them that way, why use containers at all?