查看k8s版本
% kubectl version
是如何做到的
kubectl通过restful api 连接kubernetes api server
如何工作的
kubectl [command] [TYPE] [NAME] [flags]
/usr/local/bin/kubectl run my-first-nginx --image=nginx
However, you can write either a YAML file or a JSON file to perform similar operations.
# cat nginx.yaml
apiVersion: v1
kind: ReplicationController
metadata:
name: my-first-nginx
spec:
replicas: 1
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: my-first-nginx
image: nginx
Then specify the create -f option to execute the kubectl command as follows
# kubectl create -f nginx.yaml
replicationcontroller "my-first-nginx" created
status of the replication controller
# kubectl get replicationcontrollers
CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS AGE