I'm trying to deploy a docker container to Kubernetes using YAML file (local system).
Part 1: Docker container (Working fine)
- I am able to run the container and push into docker hub
- Able to access container application over a browser.
Part 2: Kubernetes (Not working)
- Wrote deployment.yaml file that includes both deployment and service
- Deployment: It is creating pod successfully
- Service: Added service and trying to access the application over a browser but it is not working
Error: Site can't be reached
- Container pushed into docker hub
- name: $ID/tomcat-jenkins
- version: 3
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 kind: Deployment metadata: name: jenkins spec: selector: matchLabels: app: tomcat replicas: 2 # tells deployment to run 2 pods matching the template template: metadata: labels: app: tomcat spec: containers: - name: tomcat-jenkins image: $DOCKER-ID/tomcat-jenkins:3 ports: - containerPort: 80 # Service apiVersion: v1 kind: Service metadata: name: jenkins spec: selector: app: tomcat ports: - protocol: TCP port: 80 targetPort: 80 nodePort: 31011 type: NodePort
I am not able to access the application after deploying the container in Kubenetes pod.
I'm not sure whether my deployment.yaml file contains some syntax errors.