---
# System prepended metadata

title: Example app

---

# Example app

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: echoserver
  labels:
    app: echoserver
spec:
  replicas: 1
  selector:
    matchLabels:
      app: echoserver
  template:
    metadata:
      labels:
        app: echoserver
    spec:
      containers:
      - name: echoserver
        image: k8s.gcr.io/echoserver:1.4
        ports:
        - containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: echoserver
spec:
  type: ClusterIP
  ports:
  - name: web
    port: 80
    targetPort: 8080
  selector:
    app: echoserver
```

# v1beta1 Ingress with just annotation

```yaml
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: example
  annotations:
    kubernetes.io/ingress.class: ...
spec:
  rules:
  - http:
      paths:
      - path: /.well-known/test
        pathType: ImplementationSpecific
        backend:
          serviceName: echoserver
          servicePort: 80
```

# v1 Ingress with spec.IngressClassName but no IngressClass object

```yaml
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example
spec:
  ingressClassName: ...
  rules:
  - http:
      paths:
      - path: /.well-known/test
        pathType: ImplementationSpecific
        backend:
          service:
            name: example
            port:
              number: 80
```

# v1 Ingress with spec.ingressClassName and IngressClass object

```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example
spec:
  ingressClassName: ...
  rules:
  - http:
      paths:
      - path: /.well-known/test
        pathType: ImplementationSpecific
        backend:
          service:
            name: example
            port:
              number: 80
---
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
  name: ...
spec:
  controller: ...
  parameters: {}
```


# v1 Ingress with just annotation and no IngressClass object

```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example
  annotations:
    kubernetes.io/ingress.class: ...
spec:
  rules:
  - http:
      paths:
      - path: /.well-known/test
        pathType: ImplementationSpecific
        backend:
          service:
            name: example
            port:
              number: 80
```

# v1 Ingress with just annotation and IngressClass object

```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example
  annotation:
    kubernetes.io/ingress.class: ...
spec:
  rules:
  - http:
      paths:
      - path: /.well-known/test
        pathType: ImplementationSpecific
        backend:
          service:
            name: example
            port:
              number: 80
---
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
  name: ...
spec:
  controller: ...
  parameters: {}
```

# v1 Ingress with both annotation and spec.ingressClassName (not compliant with spec, but possible to create by applying over the top of an old ingress)

```yaml
# apply over previous
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example
  annotation:
    kubernetes.io/ingress.class: ...
spec:
  ingressClassName: ...
  rules:
  - http:
      paths:
      - path: /.well-known/test
        pathType: ImplementationSpecific
        backend:
          service:
            name: example
            port:
              number: 80
```