JohnShen's Blog.

Kubernetes相关记录

字数统计: 98阅读时长: 1 min
2021/09/14 Share

pod是k8s调度最小单位,一个pod可以包含一或多个container,容器间共享一个Network namespace

kubectl create -f pod_nginx.yml

1
2
3
4
5
6
7
8
9
10
11
12
apiVersion: v1
kind: Pod
metadata:
name: nginx
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80

kubectl delete -f pod_nginx.yml

kubectl get pods -o wide –all-namespaces

kubectl exec -it nginx sh 如果多个容器的话需要-c指定

kubectl describe pods nginx

kubectl port-forward nginx 8080:80 无法后台运行,不常用

CATALOG