-
Notifications
You must be signed in to change notification settings - Fork 45
/
Kubernetes Commands
42 lines (29 loc) · 1.52 KB
/
Kubernetes Commands
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
kubectl get nodes
kubectl run http --image=katacoda/docker-http-server:latest --replicas=1
kubectl describe deployment http
#Use the following command to expose the container port 80 on the host 8000 binding to the external-ip of the host
kubectl expose deployment http --external-ip="172.17.0.43" --port=8000 --target-port=80
#ping the host and see the result from the HTTP service.
curl http://172.17.0.43:8000
#Use the command command to create a second http service exposed on port 8001.
#Use the command command to create a second http service exposed on port 8001.
kubectl run httpexposed --image=katacoda/docker-http-server:latest --replicas=1 --port=80 --hostport=8001
curl http://172.17.0.43:8001
#The command kubectl scale allows us to adjust the number of Pods running for a particular deployment or replication controller.
kubectl scale --replicas=3 deployment http
#Listing all the pods, you should see three running for the http deployment
kubectl get pods
#Once each Pod starts it will be added to the load balancer service. By describing the service you can view the endpoint and the associated Pods which are included.
kubectl describe svc http
#This is deployed to the cluster with the command
kubectl create -f deployment.yaml
#As it's a Deployment object, a list of all the deployed objects can be obtained via
kubectl get deployment
# Create Service
kubectl create -f service.yaml
kubectl get svc
kubectl describe svc webapp1-svc
#Update the replicas
kubectl apply -f deployment.yaml
kubectl get deployment
kubectl get pods