Quantcast
Channel: Active questions tagged amazon-ec2 - Stack Overflow
Viewing all articles
Browse latest Browse all 29646

kubernetes in ec2 instance

$
0
0

I have a problem, now I am actively studying Kubernetes, I deployed locally minilube with vm driver virtualblox. I have application base on react, this application have dockerfile:

FROM node:12.14-alpine as dependencies
WORKDIR /tmp/
COPY package.json package-lock.json ./
RUN ["npm", "install", "--only-production"]

FROM node:12.14-alpine as build
WORKDIR /tmp/
COPY package.json package-lock.json ./
COPY --from=dependencies /tmp/node_modules ./node_modules
COPY src/ src/
COPY public/ public/
COPY .env.kubernetes .env
COPY config-overrides.js config-overrides.js
COPY tsconfig.json tsconfig.json
COPY tsconfig.dev.json tsconfig.dev.json
RUN npm install -g react-app-rewired
RUN ["npm", "run", "build"]

FROM nginx:1.17.2 as release
COPY deploy/nginx/default.conf /etc/nginx/conf.d/
COPY --from=build /tmp/build /app/build
WORKDIR /app/
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

nginx/default.conf:

client_max_body_size 1024m;

server {
  listen 80;

  root /app/build;
  index index.html index.htm;
  access_log /dev/null;

  location / {
    try_files $uri.html $uri $uri/ /index.html;
  }
}

skaffold.yaml:

apiVersion: skaffold/v1beta15
kind: Config
build:
  artifacts:
    - image: app-ui
      context: ../ui

deploy:
  kubectl:
    manifests:
      - ./manifests/ui.yaml

manifests/ui.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: ui
spec:
  selector:
    matchLabels:
      app: ui
  template:
    metadata:
      labels:
        app: ui
    spec:
      containers:
        - name: nginx
          image: app-ui
          ports:
            - containerPort: 80

---
apiVersion: v1
kind: Service
metadata:
  name: ui
spec:
  type: NodePort
  ports:
    - port: 80
      nodePort: 30300
  selector:
    app: ui

When I deploying on locally my pc using skaffold I haven't errors, but when I running minikube with vm driver none in EC2 Instance, and deployed application using skaffold, I have error: enter image description here


Viewing all articles
Browse latest Browse all 29646

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>