kubernetes dev
The following command should help dev to be able to spin up image for deployment to a kubernetes clusters.
Your image must be be running or listening to a port. You don't have to expose it on Dockerfile but the services needs to be up and listening to a port.
Simple deployment configuration
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: gowebapi
spec:
replicas: 1
template:
metadata:
labels:
app: gowebapi
spec:
containers:
- name: kepunggomux1
image: kepung/gomux1
ports:
- containerPort: 9001
name: my-name
Simple service deployment. Here we will use nodeport. Nodeport confiiguration opens up a port on every nodes so that you can talk to them.
ClusterIP opens up a port that you or your application talks to in a local cluster.
In our scenario, we will use NodePort. Here we wil use 30001 to talk to application (deployment) port 9001.
kind: Service
apiVersion: v1
metadata:
name: gowebapisvc
spec:
selector:
app: gowebapi
type: NodePort
ports:
- name: gowebapiport
port: 9001
targetPort: 9001
nodePort : 30001
protocol : TCP
Get your minikube ip
minikube ip to get your IP.
If your IP turns out to be something like : 182.0.0.10, then you can curl it using 182.0.0.10:30001
Comments