一、创建crd
1、创建 appservice-crd.yaml
[root@k8s-master opdemo]# cat appservice-crd.yaml apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: foos.app.example.com spec: group: app.example.com version: v1 names: kind: AppService plural: foos scope: Namespaced
2、创建appservice.yaml
apiVersion: app.example.com/v1 kind: AppService metadata: name: nginx-app spec: size: 2 image: nginx:1.7.9 ports: - port: 80 targetPort: 80 nodePort: 3000