Comments (3)
Most Used Commands
kubectl get <resource> --output wide
List all information about the select resource type.
Common resources include:
- Pods (kubectl get pods)
- Namespaces (kubectl get ns)
- Nodes (kubectl get node)
- Deployments (kubectl get deploy)
- Service (kubectl get svc)
- ReplicaSets (kubectl get rs)
Call resources using singular (pod), plural (pods),or with shortcuts.
Get pod by namespace: -n, --namespace
Wait for a resource to finish: -w, --watch
Query multiple resources (comma-separated values): kubectl get rs, services -o wide
kubectl create --filename ./pod.yaml
Some resources require a name parameter. A small list of resources you can create include:
- Services (svc)
- Cronjobs (cj)
- Deployments (deploy)
- Quotas (quota)
See required parameters: kubectl create cronjobs --help
kubectl edit <resource-type>/<name>
Edit resources in a cluster.
The default editor opens unless KUBE_EDITOR is specificed:
KUBE_EDITOR="nano"kubectl edit \svc/container-registry
kubectl delete Remove one more our resources by name, label, or by filename. If you want to delete pods by label in mass you have to describe the pod and gather the app=”name” from the label section. This makes it easier to cycle multiple containers at once. Add --grace-period=5 to give yourself a few seconds to cancel before deleting:
kubectl delete pod foo --grace-period=5`
kubectl edit <resource-type>/<name>
Edit resources in a cluster.
The default editor opens unless KUBE_EDITOR is specificed:KUBE_EDITOR="nano"kubectl edit \svc/container-registry
kubectl describe <resource-type> <name>
Show details of a resource.
Often used to describe a pod or node for errors in events, or whether resources are too limited to use.
A few common examples :
kubectl describe pods/nginx
kubectl describe nodes container.proj
kubectl describe pods -l name=myLabel
kubectl logs [-f] [-c] <resource-name> [<pod-name>]
View logs of a container.
Helpful when an application is dead within a pod but the pod and containers are shown as active.
Follow a log as it is created: -f, --follow
Get logs from a specific container: -c, --container
kubectl logs -f -c ruby-app web-1
kubectl apply --file ./<filename>
Apply configurations from files for resources within the cluster.
Use apply to add, update, or delete fields:
kubectl apply -f ./pod.json
cat pod.json | kubectl apply -f -
kubectl exec
is the ability to execute into a container that is having an issue but logging and debugging an app hasn’t provided any answers.
kubectl cp <source> <destination>
Copy files and directories to and from containers.
The tar binary must be in the container. This can also be used to pull or restore backups in an emergency. File location must be specified.
Copy a file from a local machine to a container: kubectl cp /tmp/cmd.txt charts/chart-884c-dmcfv:/tmp/cmd.txt
Copy file from container to local machine: kubectl cp charts/chart-884c-dmcfv:/tmp/cmd.txt /tmp/cmd.txt
from til.
- TODO: Examples of Deployment and Service templates
from til.
ReplicationController
A ReplicationController is responsible for managing the pod lifecycle and ensuring that the specified number of pods required are running at any given time.
A ReplicationController is responsible for managing the pod lifecycle and ensuring that the specified number of pods required are running at any given time. On the other hand, it is not responsible for the advanced cluster capabilities like performing auto-scaling, readiness and liveliness probes, and other advanced replication capabilities. Other components within the Kubernetes cluster better perform those capabilities.
In short, the ReplicationController has limited responsibility and gets typically used for specific implementations that do not require complex logic to attain certain requirements (for example, ensuring that the desired number of pods always matches the specified number). If there are more than the desired number, the ReplicationController removes the excess ones and ensures the same number of pods exist even in the event of node failure or pod termination.
https://opensource.com/article/21/11/kubernetes-replicationcontroller
from til.
Related Issues (20)
- Different Types Of API
- Behavioral Change Techniques
- A guide to using the Theoretical Domains Framework of behaviour change to investigate implementation problems
- No More Snake Oil: Architecting Agility through Antifragility
- Jeff's Six Simple Steps to Story Mapping Book
- Leadership skills improve behavioral engagment
- Mastering Strategic Management HOT 1
- Software delivery performance indicators
- Software Design Lectures from University of Toronto
- Review on Quality Management using 7 QC Tools
- Refactoring and Cleaning Code - Presentation by Kent Beck
- Decsision Making Frameworks - DACI, RACI
- Developer Effectiveness: Optimizing Feedback Loops
- System Design Blueprint: The Ultimate Guide
- Team Structure And Software Design
- Making Aggregate in Domain Driven Design
- What is problem statement
- Microservices Communication - Sync vs Async vs Hybrid
- GraphQL Integrity Principles - Ensuring that the graph is well-defined, stable, and consistent
- Orchestration vs Choreography, a Guide to Composing Your Monolith
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from til.