“ Have You Used Kubernetes
in Production Environment?
5
Outline
◂ Where is Your Kubernetes?
◂ High Availability/Scalability
◂ Manage Stateful Service
◂ Log/Monitoring
◂ Continuous Delivery
◂ Your Best Friend: kubectl
◂ Troubleshooting Guide
◂ Q&A
6
Select Where Your Kubernetes is!
8
Public Cloud
No
Yes
Completed
Network Infra.
General Usage
Yes
Yes
No
Shutdown
Suddenly
No Yes
No
Secure Your Kubernetes Cluster
No Matter Where it is
9
Private Network
- Kubernetes
- Database
- NAT Gateway
- ...
Public Network
- Load Balancer
- Linux Gateway
- ...
Non-Employee Only
Access Product Service
Through Load Balancer
When Should I Self-Hosted Kubernetes
◂ You Should Avoid It! Why?
◂ Unless Company Policy Not Allow
◂ And XKS Really Not Fulfill Your
Requirements (X= A, E, G...)
10
High Availability: Application in K8S
◂ Kubernetes Deployments/StatefulSets
Handle it
17
~$ kubectl get deployment
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
Nginx 3 3 3 3 18s
Stateful Service
◂ Replication Setup, e.g. MongoDB, MySQL
◂ Cluster Management, e.g. Etcd, Kafka,
ElasticSearch
◂ Scale Out, Scale Up
◂ Upgrade
◂ Data Backup
◂ Other Operation Job...
24
What is Kubernetes Operator?
◂ An Operator is a Software with Specific
Application Knowledge
◂ Extends the Kubernetes through Custom
Controller/Resource
◂ Enable Users to Create, Configure, and
Manage Applications
27
Operation of Stateless Service
29
kubectl
ReplicaSet
app=web, env=prod
Pod
app=web
env=prod
scale up
desired=3 count=1
kubectl
ReplicaSet
app=web, env=prod
Pod
app=web
env=prod
desired=3 count=3
Operation of Stateful Service
(Operator)
30
backup
kubectl
etcd Operator
app=3.0.13
size=3
Pod
app=web
env=prod
backup-tool
interval=300s
Monitoring: Internal
◂ Kubernetes Liveness and Readiness
Probes Cover Auto-Healing
◂ Prometheus Operator Include All
Kubernetes Resource Monitor
39
Ref
Monitor: External
◂ Who Can Monitor Prometheus?
◂ Suggest Find Solution to Monitor From
Outside
◂ Access From Different Country
◂ Example: Site24x7, Monitis, ...etc
40
Just My Two Cents: Pod
~$ kubectl describe pod #{Pod Name}
◂ Pending: No Node Available, Persistent
Volume Issue
◂ Terminating: Container Cannot be Killed
Normally, Login Node to Check Docker
◂ CrashLoopBackOff: No Docker Image
Exist, or Find Why Container Start Fail
51
Just My Two Cents: Service
~$ kubectl describe svc #{SVC Name}
◂ Endpoint is Empty: No Pod is Selected
For This Service
◂ NodePort Conflict With Other Service
◂ Some Modification Need To Delete Then
Re-Create
◂ Ingress Problem
52
Just My Two Cents: Node Register
◂ Overlay Network Issue Lead to Register
Fail
◂ Firewall Rule Between Node and Master
◂ ...
◂ Anyway, Login Node to Find Which
Component Encounter Trouble
53
When You Manage N Clusters N
Namespaces
◂ You Want to Perform Operation For B
Pod in D Cluster U Namespace
◂ Switch Kubeconfig to D Cluster
◂ Switch to U Namspace
◂ Start to Perform Operation For B Pod
◂ Takes Many Steps, Don’t Mention How To
Know In The Right Place?
55
There Are Several Helper Tool For You
◂ Setup Kubeconfig For Multiple Cluster
◂ Enable Shell Completion For kubectl
◂ Install kubectx to Switch Cluster or
Namespace
◂ Install kube-ps1 to Know Current Cluster
and Namespace From Terminal
◂ More Helper Tools
56