Multi-Container deployments

Hi There,

I am trying to create a multi-container deployment and its failing as the ports are not available. I tried defining containerPort for each containers and still no luck. From the logs its still trying to map port 80 to the container. Let me know how to fix this.

controlplane $ cat deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: test
name: test
spec:
replicas: 1
selector:
matchLabels:
app: test
template:
metadata:
labels:
app: test
spec:
containers:
- image: nginx:1.21.6-alpine
name: nginx
ports:
- containerPort: 8080
- image: httpd:2.4.52-alpine
name: httpd
ports:
- containerPort: 8090
controlplane $ kubectl logs test-dd9f85967-75n9x -c httpd
AH00558: httpd: Could not reliably determine the server’s fully qualified domain name, using 192.168.0.10. Set the ‘ServerName’ directive globally to suppress this message
(98)Address in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
controlplane $

Hello @sureshprabhuk7,
You can’t create a multi-container pod with two containers from the same port (Both Nginx and httpd listen on port 80)

Thanks,
KodeKloud Support