You must know! Note I think you’d better keep running scheduler. No Scheduler! What happened? When the scheduler is not running and the nodeName is undefined when the POD is created, the POD’s status is in Pending. How to change does the status Pending to Running No Scheduler Simulation POD YAML pod-definition.yml
1 2 3 4 5 6 7 8 9 10 11 12 apiVersion: v1 kind: Pod metadata: name: nginx labels: name: nginx spec: containers: - name: nginx image: nginx ports: - containerPort: 8080 Create a POD 1 kubectl apply -f pod-definition.
How the scheduler works? Scheduler If the scheduler is running, the scheduler is binding a new POD that is undefined nodeName to the Node. POD YAML pod-definition.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 apiVersion: v1 kind: Pod metadata: name: nginx labels: name: nginx spec: containers: - name: nginx image: nginx ports: - containerPort: 8080 # nodeName: node02 # -> We don't need to set this value as an default.
Process Format of Configuration Type Format Local YAML Live YAML Last Applied JSON
Two ways to manage Objects in Kubernetes Imperative Manage with Commands
You need to aware current state always. Declarative Manage with Files Imperative Commands Create Objects 1 2 3 4 5 6 7 8 # Create a POD and Run kubectl run --image=nginx nginx # Create a Deployment kubectl create deployment --image nginx nginx # Expose and Create a Deployment kubectl expose deployment nginx --port=80 Update Objects 1 2 3 4 5 6 7 8 # Edit Deployment kubectl edit deployment nginx # Scale Deployment kubectl scale deployment nginx --replicas=5 # Update Image Deployment kubectl set image deployment nginx nginx=nginx:1.
What is the Services in the Kubernetes? The Services are ways to communicate users to frontend, frontend to backend, and backend to extra datasource.
The Services enable loose coupling in between microservices in application.
The Services are in the labels/selector matched Nodes and so you can access to the Nodes with configured Port.
The Service that is in the Node can access labels/selector matched PODs with the configured Port in the Node.
You must know Kubernetes generate default namespace when it’s installed.
And there are kube-system and kube-pulibc namespaces.
DNS Connect to a service in the same namespace If you want to connect to a database that is named db-service in the same namespace that is default.
1 mysql.connect("db-service") Connect to a service in the another namespace If you want to connect to a database that is named db-service in the another namespace that is dev.