Last active
November 4, 2020 22:52
-
-
Save brucedkyle/6406a46aafb2fff66f972e61aa760dc4 to your computer and use it in GitHub Desktop.
Basic kubectl commands
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
kubectl create job job1 -o yaml --dry-run=client --image=busybox |
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
kubectl apply -f ./my-manifest.yaml # create resource(s) | |
kubectl apply -f ./my1.yaml -f ./my2.yaml # create from multiple files | |
kubectl apply -f ./dir # create resource(s) in all manifest files in dir |
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
kubectl get services # List all services in the namespace | |
kubectl get pods --all-namespaces # List all pods in all namespaces | |
kubectl get pods -o wide # List all pods in the current namespace, with more details | |
kubectl get deployment my-dep # List a particular deployment | |
kubectl get pods # List all pods in the namespace | |
kubectl get pod my-pod -o yaml # Get a pod's 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
# Create multiple YAML objects from stdin | |
cat <<EOF | kubectl apply -f - | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: busybox-sleep | |
spec: | |
containers: | |
- name: busybox | |
image: busybox | |
args: | |
- sleep | |
- "1000000" | |
--- | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: busybox-sleep-less | |
spec: | |
containers: | |
- name: busybox | |
image: busybox | |
args: | |
- sleep | |
- "1000" | |
EOF |
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
az aks get-credentials --resource-group $RESOURCE_GROUP_NAME --name $AKS_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment