容器

Kubernetes

文档: http://docs.kubernetes.org.cn/

kubectl命令

# namespace
kubectl create namespace my-namespace
kubectl delete namespaces new-namespace
kubectl get namespaces

# deployment
kubectl create -f ./xx.yaml
kubectl get deployments -n namespace
kubectl get po -n namespace
kubectl exec -ti  xx-c48dfb898-7tzrc   -n namespace  -- /bin/sh

# service
kubectl expose deployment/my-nginx -n namespace


# nfs   目录挂载
showmount -e nfs.d.com
mount -t nfs nfs.d.com://srv/nfs/xx ./nfs-mount/xx

xxx.yaml

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: test
spec:
  selector:
    matchLabels:
      app: test
  replicas: 1 
  template:
    metadata:
      labels:
        app: test
    spec:
      containers:
      - name: test
        image: nodejs:8.11.2-LTS
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 80
        volumeMounts:
            - name: nfs
              mountPath: /srv/volume/test
      volumes:
        - name: nfs
          nfs:
            server: nfs.com
            path: /srv/nfs/test

kubernetes ingress 参考 https://www.kubernetes.org.cn/1885.html

# ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test
spec:
  rules:
  - host: foo.bar.com
    http:
      paths:
      - path: /foo
        backend:
          serviceName: s1
          servicePort: 80
      - path: /bar
        backend:
          serviceName: s2
          servicePort: 80

# kubectl create -f ./ingress.yaml -n namespace
#  kubectl get ing -n namespace

你可能感兴趣的:(容器)