I am very new to azure kubernetes! Right now I am just playing around with it, trying to work out how to create things using kubectl. I already have my cluster set up, and I have created a couple of pods using an existing container in our registry. I also created an ingress controller using azure application gateway.
What I want to do next is use a deployment yaml file to add a new replicated set of pods to the cluster, with a different image in there, and add the new service endpoint to the ingress controller. Remember, I am very new to this, so I am not sure if this is what you should do, or if you should create the pods/service first and then change the ingress controller? Or if you should have a separate deployment yaml for the ingress and recreate it on its own?
Anyway, here is the deployment yaml file that I have. When I try and run it with :
kubectl apply -f deployment.yml
I just get the error :
error: error validating "deployment.yml": error validating data: invalid object to validate; if you choose to ignore these errors, turn validation off with --validate=false
So I guess my question is, am I doing this right? And if this is the way I should be adding to my cluster, any idea what is wrong with this yaml?
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: new-kuber-endpoint
namespace: kuber-ut
spec:
replicas: 2
selector:
matchLabels:
app: new-kuber-endpoint
template:
metadata:
labels:
app: new-kuber-endpoint
spec:
nodeSelector:
kubernetes.io/os: linux
containers:
- name: amica-endpoint
image: mycontainerreg.azurecr.io/new-endpoint:20220707.1
ports:
- containerPort: 80
resources:
requests:
cpu: '0'
memory: '0'
limits:
cpu: '256'
memory: 11400G
---
apiVersion: v1
kind: Service
metadata:
name: new-kuber-endpoint-service
namespace: kuber-ut
spec:
type: LoadBalancer
ports:
- targetPort: 80
name: port80
port: 80
protocol: TCP
selector:
app: new-kuber-endpoint
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: kuberdevingress
namespace: kuber-ut
uid: d9d490f0-1d3a-4433-bb03-7f1ba0dc611f
resourceVersion: '1490171'
generation: 3
spec:
rules:
- http:
paths:
- path: /old
pathType: Prefix
backend:
service:
name: old-endpoint-service
port:
number: 80
- path: /new
pathType: Prefix
backend:
service:
name: new-kuber-endpoint-service
port:
number: 80
status:
loadBalancer:
ingress:
- ip: <IP goes here>
I copied the kuberdevingress section from the azure portal, so I am not confident that is how I would recreate that ingress?