K8s
K8s Port
K8s api is available at 6443 port
Architecture
High Availability
Classic architecture for high availability
- 3 Controllers
- 5 Workers
Terms
- Manager / Controller orchestrate the load.
-
Node / Worker execute the workload.
-
Namespaces are workspaces that can be filtered by user.
- Pods are a small group of containers sharing same network, can discuss on localhost and sharing mounting points too. (But )
- Reverse-Proxy Pods specific pod running a L7 reverse proxy.
- Side-Car are small container hookted to a pods. As is place beetween pods and the others k8s services, the side car do MiTM and can provide a lot of services to pods. Authentification, autorization, and more.
- Ingress Controller is a reverse proxy acting as a gateway to k8s.
- Services are L4 load balancers.
- LoadBalancer/Ingress Controller are L4 load balancers acting as a gateway beetween internet and k8s.
-
ClusterIP are L4 load balancers before pods.
-
CNI provide network functions to k8s.
Tooling
- kubectl is a client to interact with k8s nodes and clusters. You can control remote or local k8s installation.
- Helm is a package manager for k8s. It can do templating and distribute a complete app.
- K9s is a terminal UI design to interact easily with k8s clusters.
Components
Dashboard
K8S provide a web dashboard for monitoring.
Install the dashboard
Bash
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/aio/deploy/recommended.yaml
Kubectl
Proxify k8s to localhost
Get informations from cluster
Configuration
Config file
The kubectl config is available in ./kube/
Show the kubectl config
Pods
Show list of running pods
Get list of pods from a namespace
Namespaces
Create namespace
Delete/List namespaces
User
Service Account
List service accounts
Create / Delete service account
Bash
# Create
kubectl create serviceaccount/<userAccount>
# Delete
kubectl delete serviceaccount/<userAccount>
Create an account from a .yaml
file
ServiceAccount Template
YAML
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: <username>
namespace: <namespace>
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: <username>
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: <username>
subjects:
- kind: ServiceAccount
name: <username>
namespace: <namespace>