-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCommands
57 lines (41 loc) · 2.51 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
--------------------------------------------------------------------------
IMPERATIVE - we giving all the instructions that the machine needs to do
imperative way of managing objects in kubernetes commands-
create objects -
kubectl run --image=nginx
kubectl run redis --image=redis --labels=tier=db
kubectl create deployment --image=nginx nginx
kubectl expose deployment nginx --port=80
kubectl expose pod redis --name reis-service --port=6379 --target-port=6379
kubectl create configmap <config name> --from-literal=<key>=<value>
pod
kubectl run nginx --image=nginx --dry-run=client -o yaml
kubectl run httpd --imae=httpd --port=80 --expose --dry-run=client -o yaml
deployment
kubectl create deployment --image=nginx nginx --dry-run=client -o yaml
kubectl create deployment nginx --image=nginx--dry-run=client -o yaml > nginx-deployment.yaml
service
kubectl expose pod redis --port=6379 --name redis-service --dry-run=client -o yaml
kubectl create service clusterip redis --tcp=6379:6379 --dry-run=client -o yaml
kubectl expose pod nginx --port=80 --name nginx-service --type=NodePort --dry-run=client -o yaml
kubectl create service nodeport nginx --tcp=80:80 --node-port=30080 --dry-run=client -o yaml
update objects-
kubectl edit deployment nginx
kubectl scale deployment nginx --replicas=5
kubectl set image deployment nginx nginx=nginx:1.8
kubectl create -f nginx.yaml
kubectl replace -f nginx.yaml
kubectl replace --force -f nginx.yaml - this completely removes objects and recraetes it
kubectl delete -f nginx.yaml
command to update the image of a deployment - kubectl set image <deployment name> nginx=nginx:1.9.1
DECLARATIVE - we give what we need and machien handles how.
declarative way - it reads from a file and does what it needs to do , command-
kubectl apply -f nginx.yaml - this will creat the object from yml file if the object doest exist and it will update the object if it already exist
command to get a yaml from running pod - kubectl -n <namespace> get <resource type> <resource Name> -o yaml
command to run a shell command on a pod use command - kubectl exec --namespace=kube-public curl -- sh -c ' <cmmand>'
command to generate a public key and private key for a website (TLS) -
openssl genrsa -out my-bank.key 1024 - this is privatekey
openssl rsa -in my-bank.key -pubout > my-bank.pem - this is publick key
command to create signing req to a CA -
openssl req -new -key my-bank.key -out my-bank.cer -subj "/C=US/ST=CA/O=MyOrg, Inc./CN=my-bank.com"
--------------------------------------------------------------------------