Kubectl: Difference between revisions
Jump to navigation
Jump to search
Line 48: | Line 48: | ||
|valign='top'| | |valign='top'| | ||
kubectl edit deployment -n my-namespace my-app | kubectl edit deployment -n my-namespace my-app | ||
|- | |||
|colspan='3'| | |||
---- | |||
|- | |||
|valign='top'| | |||
kubectl get deployment -n argocd | |||
kubectl get configmap -n argocd | |||
kubectl get service -n argocd | |||
kubectl get secret -n argocd | |||
kubectl get event -n argocd | |||
kubectl get pod -n argocd | |||
|valign='top'| | |||
kubectl edit deployment -n argocd argocd-redis | |||
kubectl edit configmap -n argocd argocd-rbac-cm | |||
kubectl edit configmap -n argocd argocd-cm | |||
kubectl edit service -n argocd argocd-redis | |||
kubectl edit secret -n argocd argocd-secret | |||
kubectl edit pod -n argocd argocd argocd-app-ctrl-0 | |||
|valign='top'| | |||
kubectl get deployment -n argocd argocd-redis -o yaml | |||
kubectl get configmap -n argocd argocd-rbac-cm -o yaml | |||
kubectl get configmap -n argocd argocd-cm -o yaml | |||
kubectl get service -n argocd argocd-redis -o yaml | |||
kubectl get secret -n argocd argocd-secret -o yaml | |||
kubectl get pod -n argocd argocd-app-ctrl-0 -o yaml | |||
|- | |- |
Revision as of 05:19, 24 May 2023
sudo curl -fsSLo /etc/apt/keyrings/kubernetes-archive-keyring.gpg\
https://packages.cloud.google.com/apt/doc/apt-key.gpg
cat << EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list >/dev/null
deb [arch=$(dpkg --print-architecture)\
signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg]\
https://apt.kubernetes.io/ kubernetes-xenial main
EOF
sudo apt update
sudo apt install kubectl
Kubeconfig
Kubernetes components like kubelet
, kube-controller-manager
, or kubectl
use the kubeconfig
file to interact with the Kubernetes API. Usually, the kubectl
or oc
commands use the kubeconfig
file.
The kubeconfig
file's default location for kubectl
or oc
is the ~/.kube
directory. Instead of using the full kubeconfig
name, the file is just named config. The default location of the kubeconfig
file is ~/.kube/config
. There are other ways to specify the kubeconfig
location, such as the KUBECONFIG
environment variable or the kubectl --kubeconfig
parameter.
The kubeconfig
file is a YAML file containing groups of clusters, users, and contexts.
- A cluster is a Kubernetes or OpenShift cluster.
- A user is a credential used to interact with the Kubernetes API.
- A context is a combination of a cluster and a user. Every time you execute an
oc
orkubectl
command, you reference a context insidekubeconfig
.
export KUBECONFIG=$HOME/.kube/chorke-academia-kubeconfig.yaml
chmod 600 $HOME/.kube/chorke-academia-kubeconfig.yaml
Knowledge
kubectl get deployment -A kubectl get configmap -A kubectl get service -A kubectl get secret -A kubectl get event -A kubectl get pod -A |
kubectl config --kubeconfig=./demo-config view --minify kubectl config view --minify kubectl config view |
kubectl edit deployment -n my-namespace my-app |
| ||
kubectl get deployment -n argocd kubectl get configmap -n argocd kubectl get service -n argocd kubectl get secret -n argocd kubectl get event -n argocd kubectl get pod -n argocd |
kubectl edit deployment -n argocd argocd-redis kubectl edit configmap -n argocd argocd-rbac-cm kubectl edit configmap -n argocd argocd-cm kubectl edit service -n argocd argocd-redis kubectl edit secret -n argocd argocd-secret kubectl edit pod -n argocd argocd argocd-app-ctrl-0 |
kubectl get deployment -n argocd argocd-redis -o yaml kubectl get configmap -n argocd argocd-rbac-cm -o yaml kubectl get configmap -n argocd argocd-cm -o yaml kubectl get service -n argocd argocd-redis -o yaml kubectl get secret -n argocd argocd-secret -o yaml kubectl get pod -n argocd argocd-app-ctrl-0 -o yaml |
| ||
sudo ss -tulwn | grep LISTEN sudo ss -tulpn | grep LISTEN sudo ss -tulpn | grep LISTEN | grep sshd sudo ss -tulpn | grep LISTEN | grep minio sudo ss -tulpn | grep LISTEN | grep resolve |
sudo lsof -i -P -n | grep LISTEN |
References
| ||