Last active
April 13, 2020 13:36
-
-
Save thiagomatar/2ed197e589154dec60b643b9b67c5474 to your computer and use it in GitHub Desktop.
Kubernetes Cheat Sheet
kubectl get nodesfa
kubectl run nginx --image=nginx
kubectl get pods
kubectl describe pods
kubectl describe pod pod-name
kubectl get pods -o wide
kubectl create -f pod-definition.yml
kubectl get replicationcontroller
kubectl get replicaset
kubectl describe replicasets
kubectl describe replicaset replicaset_name
kubectl replace -f rs-definition.yml
kubectl scale --replicas=6 -f rs-definition.yml
kubectl scale --replicas=6 replicaset myapp
kubectl delete replicaset myapp
kubectl get all
kubectl get deployments
kubectl describe deployments
kubectl rollout status deployment/myapp-deployment
kubectl rollout history deployment/myapp-deployment
kubectl apply -f deployment-definition.yml
kubectl set image deployment/myapp-deployment \ nginx:
kubectl rollout undo deployment/myapp-deployment
kubectl get ns
kubectl describe ns
kubectl get ns default -o yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: myapp-deployment | |
labels: | |
app: myapp | |
type: front-end | |
spec: | |
template: | |
metadata: # The data about the objects | |
name: myapp-pod | |
labels: | |
app: myapp | |
type: front-end | |
spec: # This is additional information to kubernetes | |
containers: | |
- name: nginx-container | |
image: nginx | |
replicas: 3 | |
selector: | |
matchLabels: | |
app: myapp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 # The version of Kubernetes API to using to create objects | |
kind: Pod # The type of object that will be create | |
metadata: # The data about the objects | |
name: myapp-pod | |
labels: | |
app: myapp | |
type: front-end | |
spec: # This is additional information to kubernetes | |
containers: | |
- name: nginx-container | |
image: nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# deprecated prefer use replicaset instead | |
apiVersion: v1 | |
kind: ReplicationController | |
metadata: | |
name: myapp-rc | |
labels: | |
app: myapp | |
type: frontend | |
spec: | |
template: | |
metadata: # The data about the objects | |
name: myapp-pod | |
labels: | |
app: myapp | |
type: front-end | |
spec: # This is additional information to kubernetes | |
containers: | |
- name: nginx-container | |
image: nginx | |
replicas: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: ReplicaSet | |
metadata: | |
name: myapp | |
spec: | |
template: | |
metadata: # The data about the objects | |
name: myapp-pod | |
labels: | |
app: myapp | |
type: front-end | |
spec: # This is additional information to kubernetes | |
containers: | |
- name: nginx-container | |
image: nginx | |
replicas: 3 | |
selector: | |
matchLabels: | |
type: front-end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: myapp-services | |
spec: | |
type: NodePort | |
ports: | |
- targetPort: 80 | |
port: 80 | |
nodePort: 30008 | |
selector: | |
app: myapp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment